Re: [CMake] [updated PATCH] major performance improvement for the C dependency scanner

Alexander Neundorf a.neundorf-work at gmx.net
Thu Dec 1 16:19:49 EST 2005


> Von: "Alexander Neundorf" <a.neundorf-work at gmx.net> 
>  
> Hi,  
>   
> the attached patch reduces the time a cmake-generated Makefile needs  
> until it actually starts to compile something on my box from 23 s down 
> to 7 seconds. This is still much too long, but already a lot better.  
> The box is a PIII/450 MHz, the depend.make file is about 8500 lines 
> long.  
 
... 
> * cache the contents of the new m_fileCache on a file on disk  
>   
> When a cmDependsC object is created, fill m_fileCache with the contents  
> of the saved file. Then check for each file whether it changed since 
> the cache was written on disk. If that's the case, remove the entry 
> from the cache. I think this could be a big speedup, but it is slightly 
> beyond my cmake-hacking skills.  
 
I was wrong with this, it isn't beyond my cmake hacking skills :-) 
The attached patch implements this behavior. It creates an includecache.C 
for the C dependency scanner and an includecache.CXX for the C++ scanner. 
 
I have some more numbers. My project consists of approx. 170 source 
files. To measure the time cmake consumes for itself I added as first 
source file a "foo.c" containing only the following code: 
 
#error stop here 
 
This way the time to compile any actual files can be neglected. 
I measured the following times: 
-change no file, so that no deps are scanned: 3.0 s 
-change one file, so that deps are scanned, cmake as from cvs: 23 s 
-change one file, so that deps are scanned, patch from yesterday: 6.8 s 
-change one file, so that deps are scanned, attached patch: 5.5 s 
 
This means cmake from cvs takes 20 seconds to scan the dependencies, the 
first version of the patch reduces this time down to 3.8 seconds, and the 
attached patch further down to 2.5 seconds, i.e. another 30 percent less. 
 
Please consider applying the patch. 
It has still the issue that my depend.make is 2000 lines shorter, and I 
still don't understand why.  
 
Bye 
Alex 
 
 
 

-- 
Highspeed-Freiheit. Bei GMX supergünstig, z.B. GMX DSL_Cityflat,
DSL-Flatrate für nur 4,99 Euro/Monat*  http://www.gmx.net/de/go/dsl


More information about the CMake mailing list