Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile Times #443

Open
sjunges opened this issue Nov 25, 2023 · 5 comments
Open

Compile Times #443

sjunges opened this issue Nov 25, 2023 · 5 comments

Comments

@sjunges
Copy link
Contributor

sjunges commented Nov 25, 2023

Generally, we are still fighting relatively long compile times despite major efforts to reduce them. I wanted to open this issue for some time to push us to improve here a bit further.

Earlier today, I generated a ninjatrace for building storm, completely, as a release build. This took 8m20s on my laptop, running 8 threads in parallel.

I attach the file here, you can open it in chrome://tracing to inspect it yourself. I also attach a screenshot

trace.json
image

You can see that on storm-main, many files actually compile rather quickly, however, towards the later stages, compile times increase drastically. I believe that this effect is mostly due to earlier efforts to reduce the compile times of often-recompiled parts.

I inspected one file, CtmcCslModelCheckerTest.cpp. This file took a whopping 30 seconds to compile. Why? With clang-profiling (see our Cmake option to enable this), it turned out that around 23s were due to including FormulaParser.h and PrismParser.h. There was a simple improvement to compile this file in 7 seconds rather than in 30: Do not include these two files. The code still compiles.

@sjunges
Copy link
Contributor Author

sjunges commented Nov 26, 2023

Regarding header includes
I did some further experiments. E.g., every file that includes in some way or the other carl's multivariate polynomials also includes the carl file FunctionSelector which depends on boost/mpl and this adds roughly 100ms of compilation time. Negligble for an an individual file, but maybe not negligible overall.

Furthermore, quite a significant amount of time is spent on standard headers. My experiments show that precompiled headers are a solution here and can speed up the overall compilation from around 8 to around 6 minutes! :-)

Quite some files include the expression-evaluator, which includes exprtk.h (700ms).

Finally, every file that includes logging includes the filesystem header (also 100ms) as l3pp is a header-only library. I think that we may want to move the implementation of file handling to a dedicated file.

Regarding instantiations
Some instantiations indeed add a lot of time, e.g., some key operations on multivariate polynomials (together roughly 600 ms?) and the json library (700ms)
I think we may want to use extern template instantiations to compile them only once.

Regarding unity builds
Switching on unity builds is currently not working as there are some carl headers which can only be included in a specific order and this somehow failed with cmake unity builds. It may be possible to fix this issue.

Regarding storm-pars and tests
The main issue is actually the use of storm headers that include many parsers and therefore cost various seconds to include.

Another issue seems to be the use of carl::formula. However, we hardly use them and the use-cases for them are mostly gone, so I would argue to switch to storm::expressions.

Regardint tests
Another header that is currenlty widely used in tests that is very expensive is the parser/DirectEncodingParser.h as this includes the valueparser.h and thus all the spirit-definitions. This seems not necessary ...

@sjunges
Copy link
Contributor Author

sjunges commented Dec 3, 2023

Precompiled header support: #451

@sjunges
Copy link
Contributor Author

sjunges commented Dec 3, 2023

Significant include optimisations for tests and libraries: #450

@sjunges
Copy link
Contributor Author

sjunges commented Dec 4, 2023

Instantiations for json objects are significantly reduced by: #459

@volkm
Copy link
Contributor

volkm commented Dec 5, 2023

Just for (my) documentation:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants