[cmake-developers] CMake is slow for project with hundred target and one command with large number of dependencies

Stephen Kelly steveire at gmail.com
Mon Jul 15 07:51:08 EDT 2013


Nicolas Desprès wrote:

>> Yes that one or cmMakefile::GetSourceFileWithOutput(char const*). I can
>> send you a gzipped of my callgrind data off-list if you want (it
>> weights 534K).
>>
> If we had a map associating each input to output, we could maybe have
> better performance. WDYT?

Perhaps. I can probably create the same callgrind data locally anyway, but I 
won't have a change until later to dig into this.

On looking at the cmMakefile::GetSourceFileWithOutput code though, it seems 
that it might also be useful to maintain this->SourceFiles 
and (*i)->GetCustomCommand()->GetOutputs() as sorted vectors. They are 
rarely modified, so the O(1) -> O(log N) inserts probably won't matter much, 
but the O(N) -> O(log N) might provide a useful gain. Or, as most access is 
at generate time, keep the O(1) insertions, sort() after the configure step, 
and then use the binary search at generate time. Of course, I don't know if 
there are also configure-time accesses which would be difficult to isolate 
from the generate-time ones.

Does that make any sense?

Thanks,

Steve.





More information about the cmake-developers mailing list