Improve compile times
I'm a little annoyed by the rather lengthy compile times. I'm having 16 CPU cores and I still need 30s to compile the library and another 1:40s to build all the tests (on a 8 core, 16 thread machine)
Some things we could to:
A conceptually easy step would be to switch to doctest (take a look at their compile time benchmarks, they're their own so take it with a grain of salt). But most likely it would be quite a bit of manual labour to port all our test cases.
Easy changes include removing unused headers, we have some places of
<iostream>, which is usually pretty heavy weight, and in all cases we should use our
Other changes include forward declarations, and PIMPL. I would be interested if we should at least try if we can reduce build times with that.
More complicated changes could involve removing the
<memory>header and with it uses of
unique_ptrand replacing it with a simplified self rolled version (idea taken from Magnum, TLDR: this quasi unique pointer can't take custom deleters and can't work with arrays, which we both don't use. This framework also has a similar thing for
std::optional). This would also get more important, the more the PIMPL idiom is used. Not sure myself about it. I don't really want to reinvent the wheel, but yeah I'm annoyed.
Also we sometimes store stuff in a
unique_ptr, where I'm unsure if it's needed from a functional point (see Scaling.h:77 or EmissionLogLikelihood:91). Maybe these should be
std::optional? I don't know that saves us any compile time but at least we might express intent a little more
I would be interested in your thoughts. Would you consider using any of the above changes? Are some absolute show stoppers? If so I would be happy to investigate it. I could try it on a subset of the modules and see if anything actually improves.
I would love to see the the library build in under 15s (maybe even under 10s) on my machine and the tests in under 1min. This might be hard to achieve, but I think it would be worth it!