[cmake-developers] profiling cmake

Alexander Neundorf neundorf at kde.org
Sun Oct 22 09:25:06 EDT 2006


Hi,

the last days I did some callgrind profiling on cmake.
Running cmake on kdelibs directly after booting takes 1:23 min, with the cache 
filled at takes 23 seconds on my PIV 1.8 GHz/512 MB RAM notebook.
The only functions which consumed a significant amount of time were the yy_* 
parsing functions, approx. 10%.
There are approx. 8 million calls to malloc (and free), 9 million calls to 
strlen() and 14 million calls to std::string::compare().
Here you can find the callgrind data:
http://www.neundorf.net/cmake/callgrind.out.9628.bz2

I also checked using strace.
There are 28,000 stat64() calls. That's a lot but probably required.
There are 166,208 calls to 
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...});
I don't know what this does and where it comes from and whether it consumes a 
siginificant amount of time.
Here you can find the strace file:
http://www.neundorf.net/cmake/cmake.kdelibs.strace_automoc_ein_file_write.c.bz2

So, I'm not sure whether there is much room for improvements. Maybe some cache 
for turning ${somevar} into a vector<string>, using maybe cmVariableWatcher 
to check whether somevar has changed in the meantime. Caching maybe 10 
variables would probably be enough, since variables often are used only in 
one file and not in others.

Bye
Alex
-- 
Work: alexander.neundorf AT jenoptik.com - http://www.jenoptik-los.de
Home: neundorf AT kde.org                - http://www.kde.org
      alex AT neundorf.net               - http://www.neundorf.net



More information about the cmake-developers mailing list