[cmake-developers] [CMake] CMake 2.8.12.201401116 is much slower than 2.8.12.1

Brad King brad.king at kitware.com
Thu Jan 16 14:31:42 EST 2014


On 01/16/2014 02:18 PM, Clinton Stimpson wrote:
> On Thursday, January 16, 2014 11:49:58 AM Ben Boeckel wrote:
>> On Thu, Jan 16, 2014 at 08:41:58 -0700, Clinton Stimpson wrote:
>>> I'm surprised how this small change added a 20% slowdown.
>>> -set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG
>>> QT_DEBUG)
>>> +set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<NOT:
>>> $<CONFIG:Debug>>:QT_NO_DEBUG>)
[snip]
> However, the profile of my test case showed that the time increase is in the 
> parser (yylex).  Perhaps someone else can look further into this.

The addition of '$' to the value to causes the fast-path in
cmMakefile::ExpandVariablesInString to be skipped:

 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmMakefile.cxx;hb=v2.8.12.1#l2535
 if ( source.empty() || source.find_first_of("$@\\") == source.npos)
   {
   return source.c_str();
   }

Instead full expansion using cmCommandArgumentParserHelper occurs
which is much slower.  The latter code path is ripe for optimization
by re-implementing it without flex/bison generators.  Unfortunately
the current logic has so many idiosyncrasies that a re-implementation
will almost certainly introduce subtle behavior changes.

-Brad




More information about the cmake-developers mailing list