[CMake] Obtaining improved GNU make performance on Makefiles generated by cmake

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sun Mar 23 22:37:29 EDT 2008


On 2008-03-18 10:06-0400 Bill Hoffman wrote:

> Bill Hoffman wrote:
>
>> 
>> 
>> We used to have something that removed many implicit rules.  I think that 
>> got lost in some version of CMake, it is hard to test...   I did find that 
>> there is a command line option to gmake, -r that turns off implicit rules. 
>> I am seeing a speed up with gmake -r.   Would it work to turn off all 
>> implicit rules instead of the .PHONY stuff?  CMake does not use any 
>> implicit rules anyway.  I think the only way to turn them off is to 
>> redefine them as empty rules.  This works for all make, and not just 
>> gmake.  I am trying to figure out what implicit rules need to be turned 
>> off and how to turn them off.  Any ideas?
>> 
>> 
>
> I played around with make -d and -p and found that the .SUFFIXES rule that 
> was supposed to be removing the implicit rules for gmake was not working for 
> everything.   SCCS and RCS were being checked for a bunch of stuff.   Anyway, 
> try this and see if it improves the issue you were seeing:
>
>
> $ cvs commit -m "ENH: try to improve make speed by getting rid of some 
> implicit rules that were still around." cmLocalUnixMakefileGenerator3.cxx
> /cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.cxx,v  <-- 
> cmLocalUnixMakefileGenerator3.cxx
> new revision: 1.241; previous revision: 1.240

Hi Bill:

Plplot now builds for the cvs version of CMake so I am finally in a position
to continue this thread.

Here is the 2.4.8 latency for the current version of PLplot

software at raven> time make >& /dev/null
real    0m1.454s
user    0m0.800s
sys     0m0.724s

By repeating this command, I get variations of typically 0.01 seconds in this
result.  (I also confirmed the command did not actually build anything new,
i.e. it is a true measure of Makefile latency.)

For cmake version 2.7-20080320 (that cvs update done after the above commit)
the latency has been increased (by 60 per cent) to

real    0m2.319s
user    0m1.356s
sys     0m1.068s

Again, I confirmed it was a true measure of the Makefile latency.

I also did some tests with the -r option for GNU make.

For 2.4.8 the latency is reduced by a factor of 1.5 to

software at raven> time make -r >& /dev/null

real    0m0.970s
user    0m0.636s
sys     0m0.568s

That would indicate there is a lot to be gained by the .PHONY target for
the non-file rules in generated GNU Makefiles.

For the cvs version of CMake the latency is reduced hardly at all by
the -r option

software at raven> time make -r >& /dev/null

real    0m2.287s
user    0m1.324s
sys     0m0.964s

In sum, the current result for the cvs version of cmake seems to create
builds with significantly increased latency compared to 2.4.8.  The -r
option greatly increases this disparity.  I think this is an important
enough result that further tests of "make" latency for other software
projects are important to confirm these results.

Question for Alex Nuendorf:

Alex, I imagine the KDE latency is much larger than PLplot's since your
build has _a lot_ more dependencies to check.  Are the current KDE builds in
good enough shape so that repeat make commands measure true Makefile latency
rather than some issue with unneeded compilation, linking, or whatever?  If
so, I would be very interested in your latency results for cmake-2.4.8
versus the cvs version of CMake.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list