MantisBT - CMake
View Issue Details
0008726CMakeCMakepublic2009-03-11 18:532009-03-17 13:10
Derek Bruening 
Brad King 
normalminoralways
closedfixed 
CMake-2-6 
 
0008726: progress and status messages slow down build by up to 50% => should be disable-able
CMake invokes two extra commands prior to compiling each source file: a message "Building C object foo.c.obj" and a status update "[xx%]". On Windows, when building my C software, these extra commands, each invoking a separate instance of cmake.exe, increase the build time by nearly 50% under cygwin as compared to the hand-written gmake Makefiles I was using before (invoking the same cl.exe and other tools):

    pre-CMake raw Makefiles using cygwin make: 1:06
    CMake -G"Unix Makefiles" + cygwin make: 1:40

-DCMAKE_COLOR_MAKEFILE=OFF makes a marginal difference (uses "echo" instead
of "cmake -E cmake_echo_color") but not much:

    CMake -G"Unix Makefiles" + cygwin make: 1:38

NMake is faster but as we will see still slowed down noticeably:

    CMake -G"NMake Makefiles" + nmake: 0:51

Now if I hand-remove most of the two status commands via

    for i in `find . -name \*build.make`; do sed -i '/cmake_echo/d;/progress/d' $i; done

We have:

    CMake -G"Unix Makefiles" + cygwin make: 1:08
    CMake -G"NMake Makefiles" + nmake: 0:46

There is no option to remove either the "Building" message or the progress messages. I opened this case as a Performance Bug, and it would be best addressed by adding two new option variables, perhaps CMAKE_ENABLE_PROGRESS and CMAKE_ENABLE_STATUS, so that I can disable both. When I'm doing batch builds I don't want either of the messages (cl.exe is already printing out the name of each file in any case); for a user building my software once, I do think the messages are useful.

Perhaps a separate case should be opened for longer-term solutions that keep the progress messages but implement them more performantly. Certainly the "Building" message could be folded into the cmake_progress_start command. Or maybe just printing the progress on each target instead of each file is sufficient for a Makefile build.
No tags attached.
Issue History
2009-03-11 18:53Derek BrueningNew Issue
2009-03-11 18:55Derek BrueningNote Added: 0015662
2009-03-12 14:33Bill HoffmanStatusnew => assigned
2009-03-12 14:33Bill HoffmanAssigned To => Bill Hoffman
2009-03-16 16:22Brad KingAssigned ToBill Hoffman => Brad King
2009-03-16 16:23Brad KingNote Added: 0015701
2009-03-16 16:26Brad KingNote Added: 0015702
2009-03-16 16:28Brad KingNote Deleted: 0015702
2009-03-16 16:29Brad KingNote Added: 0015703
2009-03-16 16:57Brad KingNote Added: 0015706
2009-03-17 13:10Brad KingStatusassigned => closed
2009-03-17 13:10Brad KingResolutionopen => fixed

Notes
(0015662)
Derek Bruening   
2009-03-11 18:55   
xref bug 5323 proposing an environment variable (seems an odd choice) to
disable progress messages but for different reasons
(0015701)
Brad King   
2009-03-16 16:23   
The following commits allow progress rules to be disabled. You can build with

  -DCMAKE_COLOR_MAKEFILE=OFF -DCMAKE_RULE_PROGRESS=OFF

to avoid all the extra processes.

ENH: Factor out makefile progress rule commands
/cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.cxx,v <-- Source/cmMakefileTargetGenerator.cxx
new revision: 1.116; previous revision: 1.115
/cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.h,v <-- Source/cmMakefileTargetGenerator.h
new revision: 1.27; previous revision: 1.26

ENH: Allow projects to disable per-rule progress
/cvsroot/CMake/CMake/Modules/CMakeGenericSystem.cmake,v <-- Modules/CMakeGenericSystem.cmake
new revision: 1.21; previous revision: 1.20
/cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.cxx,v <-- Source/cmMakefileTargetGenerator.cxx
new revision: 1.117; previous revision: 1.116
/cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.h,v <-- Source/cmMakefileTargetGenerator.h
new revision: 1.28; previous revision: 1.27
/cvsroot/CMake/CMake/Source/cmake.cxx,v <-- Source/cmake.cxx
new revision: 1.413; previous revision: 1.412
/cvsroot/CMake/CMake/Tests/Complex/CMakeLists.txt,v <-- Tests/Complex/CMakeLists.txt
new revision: 1.73; previous revision: 1.72
(0015703)
Brad King   
2009-03-16 16:29   
Oops, my 'echo' tests were in plain .bat files not in NMake or cygwin Make. It looks like the make tools will still start a whole process for each echo line too.
(0015706)
Brad King   
2009-03-16 16:57   
Okay, let's try this again. I renamed RULE_PROGRESS to RULE_MESSAGES and made it apply to both progress and status. I see no reason to allow either one without the other. Now you can build with

  -DCMAKE_RULE_MESSAGES=OFF

to avoid the extra processes. I suggest using CMAKE_VERBOSE_MAKEFILE too so you can see what is going on if something fails.

STYLE: Separate unrelated logic
/cvsroot/CMake/CMake/Source/cmMakefileLibraryTargetGenerator.cxx,v <-- Source/cmMakefileLibraryTargetGenerator.cxx
new revision: 1.70; previous revision: 1.69

ENH: Allow projects to disable per-rule echo lines
/cvsroot/CMake/CMake/Modules/CMakeGenericSystem.cmake,v <-- Modules/CMakeGenericSystem.cmake
new revision: 1.22; previous revision: 1.21
/cvsroot/CMake/CMake/Source/cmMakefileExecutableTargetGenerator.cxx,v <-- Source/cmMakefileExecutableTargetGenerator.cxx
new revision: 1.55; previous revision: 1.54
/cvsroot/CMake/CMake/Source/cmMakefileLibraryTargetGenerator.cxx,v <-- Source/cmMakefileLibraryTargetGenerator.cxx
new revision: 1.71; previous revision: 1.70
/cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.cxx,v <-- Source/cmMakefileTargetGenerator.cxx
new revision: 1.118; previous revision: 1.117
/cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.h,v <-- Source/cmMakefileTargetGenerator.h
new revision: 1.29; previous revision: 1.28
/cvsroot/CMake/CMake/Source/cmake.cxx,v <-- Source/cmake.cxx
new revision: 1.414; previous revision: 1.413
/cvsroot/CMake/CMake/Tests/Complex/CMakeLists.txt,v <-- Tests/Complex/CMakeLists.txt
new revision: 1.74; previous revision: 1.73