libadm
libadm copied to clipboard
Speed up build
libadm is quite slow to build, which makes it less pleasant to work on than it could be. This issue is here to collect ideas and track progress.
Some ideas:
- build all the tests into one executable, and use catch cmake integration to make it nice to work with (some progress)
- speed up compilation of individual objects, mostly by reducing the amount of code pulled in by headers
- set up IWYU and follow it's recommendations (some progress)
- where possible, use headers containing forward declarations of boost::optional and similar
- improve the use of forward declarations in the library
- currently
elements_fwd.hpp
isn't that useful, because headers for elements depend onParameterTraits<T>::tag
, which only works if the real header forT
is included. This means that most of them end up including full headers for all other types. This can be improved by addingParameterTraits
overloads for all elements intype_traits.hpp
orelements_fwd.hpp
. -
document.hpp
should useelements_fwd.hpp
, butdocument.hpp
is used as a root header to include everything. It should probably be turned into a wrapper that includeselements.hpp
anddocument_impl.hpp
, and internal parts which need a definition ofDocument
should be changed to includedocument_impl.hpp
- currently
- consider moving implementations out of common headers like
id_assignment.hpp
and into implementation files. In this case the header should only need the forward declaration for IDs, not all the full declarations!
Try profiling build time using (for example) https://devblogs.microsoft.com/cppblog/analyze-your-builds-programmatically-with-the-c-build-insights-sdk/ to identify what is slow.
Looks like clang has https://aras-p.info/blog/2019/01/16/time-trace-timeline-flame-chart-profiler-for-Clang/