[CMake] slow CMake performance configuring builds on remote SMB servers

Bill Hoffman hoffman.mlist at gmail.com
Fri Mar 23 15:38:09 EST 2007


Philip Lowman wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Bill Hoffman wrote:
>   
>>
>> Most files cmake writes out are copy if different.  So, cmake writes a
>> file, then diff's it with the
>> file that was already there, and if they are different it gets rid of
>> the original and moves the new
>> file into place.   This is to avoid too many reloads and other side
>> effects of changing all the
>> files all the time.   It would be a lot of work, but I suppose you might
>> be able to build the whole
>> tree in some staging area, then move it later.   But, that sounds very
>> difficult.   It may just be
>> that running cmake over network drives on windows is slow....
>>     
>
> Hmm.. so CMake writes out a temporary file and then diffs it against the
> existing file using the operating system and only moves it back into
> place if it's out-of-date?
>
> If I understand this correctly there's a simple optimization that could
> be used which might dramatically improve performance.  Simply do the
> diffing within CMake between the "new" file (in memory) and the "old"
> file (already in memory because it's been read in).  Then only write the
> file out if it's changed.
>   
Sure, and that has been on the todo list for some time, but code wise it 
is not that easy.  Involves creating
sub-classes of c++ streams and such.   See the class 
cmGeneratedFileStream for how it is currently
done.  If anyone can get a clean implementation that works, I would be 
happy to put it in CMake.   It should
only involve "fixing" the class cmGeneratedFileStream.

-Bill



More information about the CMake mailing list