[CMake] Compilation speed with CMake/NMake combination, making
it faster?
Jason Stewart
jstewart at pobox.com
Tue Dec 11 10:03:02 EST 2007
Bill Hoffman wrote:
> Christian Ehrlicher wrote:
>
>>>>
>>>>> * We're using an NMake build tree, is NMake particularly
>>>>> slow? Do any of the other makes work more efficiently?
>>>> Be aware that nmake builds are much slower than using devenv, as nmake
>>>> starts a cl.exe process for every single file,
>>>> whereas devenv calls cl.exe with several source files. This costs, due
>>>> to the high process overhead on Windows.
>>> I understand that.
>> It's not a nmake problem but a problem of cmake. cmake does not
>> support batched build - already opened a bug long time ago because of
>> this.
>>
>>
>
> I am not sure how much faster a batch build would be. The real issue
> is the dual or more core machines. Even with a batch build and cl, it
> still only uses one processor, where devenv uses more. I use gmake
> and cl to get around this with -j N. However, gmake is slower than
> nmake because it uses the POSIX stat which is VERY slow on Windows.
> Someday I am going to hack gmake to use the Windows native calls to
> stat files. I almost think that would be time better spent than adding
> batch cl calls to CMake. I would like to see some bench marks on cl
> batch builds. It will not be trivial to implement and I don't think
> it would be worth the effort unless it has a big gain.
This is not scientific but I wrote a quick perl script to compile a
simple library that we use (GCTPc). It consists of 70 C files with most
of the files between 5K and 6K, a few are as large as 70K. The script
just uses the time() function to grab the elapsed seconds and runs three
tests. The first runs one cl.exe process with all 70 files with the '-c'
flag to only compile. The second compiles each C file with it's own
invocation of cl.exe. The last repeats the first, but with the new,
experimental, '/MP' flag that does multiprocessor builds.
I get the following times for these files:
all files : 2 seconds
single files : 7 seconds
mp build : 1 second
I repeated this test with a set of 15 C++ files that are larger with
template code and that take significantly longer and I got the following
times:
all files : 60 seconds
single files : 78 seconds
mp build : 51 seconds
So, even on the single processor build the single invocation is almost
25% faster.
Take it all with a grain of salt.
Jason
More information about the CMake
mailing list