[cmake-developers] slow regex implementation in RegularExpression

Alexandru Ciobanu alex at rogue-research.com
Thu Nov 17 15:19:47 EST 2011


Hi everyone,

[ CMake + TRE ]
I was able to make CMake use TRE, by changing the RegularExpression.{cxx,hxx.in} files.

I ran the CMake tests, and 100% pass. See the attached log file. 
(NOTE: Bootstrap, complex, complexOne were initially not aware of TRE dependency, but I fixed that easily).


[ Impact of using CMake + TRE on our builds ]
We picked one of our build machines and replaced the ctest binary on it.
The impact on the build time is pretty dramatic:
     CMake:				7h39m
     CMake + TRE:			1h06m       

This is a machine that has two cores.

On machines that have more cores, the impact is even greater.  On my 8 core machine, running a particular build task:
     CMake:				19m57s
     CMake + TRE:			 1m30s       


[ Regular expressions syntax ]
In terms of regular expressions syntax, the only difference that I've seen is that TRE treats the curly brackets "{" and "}" as special characters, because it uses them for its "approximate matching".  Details here:
      http://laurikari.net/tre/documentation/regex-syntax/

The only CMake component that uses curly brackets in a regexp is:
    Modules/FindJNI.cmake
but it was trivial to fix because they were used as mere delimiters.

As mentioned earlier, after this change 100% of the tests pass.


[ Implications ]
Note that CTast is *not* the only component that would benefit from faster regular expressions.

I've found at least one other reported case when regular expression were too slow in CMake:
    http://public.kitware.com/Bug/print_bug_page.php?bug_id=5537

Since Glob uses RegularExpression, I would not be surprised if CMake+TRE will be faster on large code bases.


CONCLUSION: 
  - TRE is fast, benefits build times immensely

QUESTION:
  - Does anyone see a problem if we add TRE in CMake the same way as ZLIB, CURL, etc? (i.e. in ./Utilities/) 


sincerely,
Alex Ciobanu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20111117/a03ffa99/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: time.ctest.alex.log
Type: application/octet-stream
Size: 28062 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20111117/a03ffa99/attachment-0002.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20111117/a03ffa99/attachment-0001.html>


More information about the cmake-developers mailing list