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

Brad King brad.king at kitware.com
Thu Apr 3 13:22:49 EDT 2014


On 01/29/2014 09:22 AM, Brad King wrote:
> I explained here:
> 
>  http://www.cmake.org/pipermail/cmake-developers/2014-January/009487.html
> 
> how the '$' in a value changes some core logic from a short-circuit
> to a complex evaluation.  However, the question now is why does this
> one COMPILE_DEFINITIONS property value get evaluated so many times
> that it becomes so noticeable.
> 
> How many directories (add_subdirectory) and targets (add_library or
> add_executable) does the project have?

To follow up here, we managed to find the reason the '$' makes things
so slow.  It can actually happen with only a single evaluation.  The
problem is the value ends up being appended to a very large string
(a list of include directories) and then passed through a macro
argument.  Since macros re-parse their arguments the large string
goes through ExpandVariablesInString and is very slow now that the
'$' prevents use of the fast-path.

There is separate ongoing work to improve the ExpandVariablesInString
slow-path performance, but for now we managed to solve the problem
for this Qt4 case with a simple change:

 Qt4Macros: Make QT4_CREATE_MOC_COMMAND a function
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7beba986

-Brad



More information about the cmake-developers mailing list