[cmake-developers] slow regex implementation in RegularExpression

Brad King brad.king at kitware.com
Tue Nov 22 16:39:53 EST 2011


On 11/22/2011 1:50 PM, Alexandru Ciobanu wrote:
> As Brad King suggested, instead of changing the files in Source/kwsys/,
 > I created a wrapper class and made all the calls go through it.

Thanks.

> I also added the TRE library to Utilities/cmtre, and added CMAKE_USE_SYSTEM_TRE.
>
> I added the patch to the bug tracker:
> http://public.kitware.com/Bug/view.php?id=12381

Please add a note there indicating the CMake version (git commit sha1)
on which the patch was based.  Otherwise I cannot apply it cleanly.

> Needless to say, the patch fixes the performance problem.

Great!

> To keep things simple I omitted several things:
> - TRE library bootstrapping (so now the Bootstrap test will fail)

The KWSys implementation will not be going away, so we can fall back to
that one during bootstrapping.

> - the suggested policy to enable/disable approximate matching in TRE

Please read up on policies to make sure you understand them:

   http://www.cmake.org/Wiki/CMake/Policies
   http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:cmake_policy
   http://www.cmake.org/cmake/help/cmake-2-8-docs.html#section_Policies

We will need a policy to know how to treat a regex containing one of
the characters that behaves differently in TRE.  The OLD behavior of the
policy will escape them to get the old matching behavior.  The NEW behavior
of the policy will use the new matching features.

We also need to identify the contexts that offer regex matching but have
no way to set the policy.  For those we need to decide if we can simply
use the new behavior outright or provide another way to switch it.

It is tempting to always require explicit requests for new TRE behavior,
such as using "TRE" instead of "REGEX" in keyword locations, but one
advantage of using a policy is that over time the old behavior will
disappear completely from usage.

> - proper checks when building TRE with CMake as done in its ./configure.ac

IOW, porting TRE to build properly with CMake, right?

> - Is the approach correct?

Yes.  I will review the patch in more detail next week and after I know
where to apply it.

> - What next?

We need to establish a transition plan, which mostly consists of the above
policy discussion.

-Brad



More information about the cmake-developers mailing list