Silly CMake 2.8.2 regex causing slow project load in KDevelop

Andreas Pakulat apaku at gmx.de
Mon Jul 19 07:21:16 UTC 2010


On 18.07.10 23:35:36, Nicolás Alvarez wrote:
> Since I upgraded to CMake 2.8.2, KDevelop takes almost four minutes to
> load my project, before it appears in the Project toolview and C++
> parsing starts. I tracked it down to a very slow regex in
> FindZLIB.cmake:
> 
>    FILE(READ "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H)
>    STRING(REGEX REPLACE ".*#define ZLIB_VERSION
> \"([0-9]+)\\.([0-9]+)\\.([0-9]+)\".*" "\\1.\\2.\\3"
> ZLIB_VERSION_STRING "${ZLIB_H}")
> 
> On my machine, and with my zlib.h, QRegExp takes 3 minutes 55 seconds
> to process the regex (measured, test case attached),

Hmm, just tried this and if I generate a release-build for your sample
then it takes less than a fraction of a second to run it. If I change
the qmake project to do a debug build it indeed takes a long time to do
the replacement.

Whats the expected output of your app for the 4-digit and 3-digit
version number? The reason I'm asking is that I get different output
depending on release/debug mode compilation for the 3-digit zlib version
(the 4-digit always prints out "" as 3rd line).

Andreas

-- 
Someone whom you reject today, will reject you tomorrow.




More information about the KDevelop-devel mailing list