[CMake] Tips on reducing configure time

Poughon Victor Victor.Poughon at cnes.fr
Wed Nov 14 07:25:21 EST 2018


Yes you are correct on all your observations. We already use ninja and ccache wherever we can. In fact we have an issue about the whole end-to-end build performance where we track all effort on this throughout the project (if you're interested: https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/issues/1649)

There are indeed quick and easy wins to be had with those tools (and we are working on it). But my original question is not about that. It's about speeding up the configure step with makefile generator. I still don't think it's normal that it does hundreds of thousands of I/O on files that are a few bytes or even empty. However it's possible that it's because we do something incorrect in our CMakeLists.txt and not CMake's fault.

It's true that a few minutes of configure is not much when doing a full build, but consider incremental builds where all you do is change one cxx file (and cmake is triggered because you changed git branch or something). Then the generate step is a significant part of the time you wait.

Victor Poughon

De : Eric Noulard <eric.noulard at gmail.com>
Envoyé : mercredi 14 novembre 2018 12:34
À : Poughon Victor <Victor.Poughon at cnes.fr>
Cc : CMake Mailinglist <cmake at cmake.org>
Objet : Re: [CMake] Tips on reducing configure time


Le mer. 14 nov. 2018 à 12:06, Poughon Victor <Victor.Poughon at cnes.fr<mailto:Victor.Poughon at cnes.fr>> a écrit :
Thanks for the replies

You can see configure times on our dashboard (switch to advanced view): https://dash.orfeo-toolbox.org/index.php?project=OTB
It ranges from 1-3min. There's even one windows machine that's at 4m30s.

Somes windows system are known to be slow on many files accesses.
However on this particular machine (https://dash.orfeo-toolbox.org/buildSummary.php?buildid=342008 I guess) you already seem
to be using NInja + MSVC. so many small files access to ?makefiles? should not be the culprit.

That said whatever the system your build and test time seems to dominate the overall time (in the CI).

I have had great speed-up experience using CMake+ninja+ccache  for our build in CI. We did go from 1 hour down to less than 10min.
We only have various linux build (no Windows) it is really a big time savior combo.

We even share the compil' cache between the CI and the developers. So everybody is feeding compile cache and takes benefits from others including CI.

You seem to be using that as well here:
https://dash.orfeo-toolbox.org/buildSummary.php?buildid=341993
and you get less than 5min build time which corroborate my suggestion.

The same machine build with clang: https://dash.orfeo-toolbox.org/buildSummary.php?buildid=342033 is lasting 30min+
and is not using ccache.

Thanks for the tip about Ninja generator, it's indeed much faster. But switching the entire dev team + CI servers from make to ninja is not really an option for us right now because of a bug in ninja that affects our SuperBuild configuration (see here if you're interested in the details: https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/issues/1625)

I see.
Not using ninja in the Superbuild case does not mean you cannot use it in other cases, right?
May be the one-size fits all is a little too much to ask at this point? My opinion though.
Did you report the issue upstream (ninja or cmake)?

I was impressed in the past by the amount of tests orfeo is doing, I'm still are !!
Are you running those tests in parallel (with ctest --parallel) ? It can be a time savior as well is the running machine has a fair amount of cores and memory.


--
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20181114/542d4736/attachment-0001.html>


More information about the CMake mailing list