-
Notifications
You must be signed in to change notification settings - Fork 27
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
[FEATURE] Optimize compilation speed by reorganize headers #486
Comments
I also think that the fact that we do not use builder patterns increases this issue. that's why e.g. test_math_solver.cpp needs all solvers, even though not all solvers are needed for all tests We can do something with the math solvers in the same way as we do for the I also would recommend putting the Making smaller test files should also help, because |
irrelevant for CI but relevant for local development: i also think that we can split up the build target of the unit tests into multiple smaller ones to prevent the need of compiling all tests even though you're only looking into the deepest one |
@mgovers please modify the main content with your suggested header reorganization. |
This could be the next step if the compilation speed is still not satisfying after optimizing the header structure. My guess is that the target compilation speed should be improved (with incremental build) when the headers are decoupled a bit. |
This might be very novice input, but aren't we making heavy use of templates? I think normally that is also not the easiest thing when it comes to compiling. |
yes but its also the thing that makes our code fast, so that's part of the trade-off. making heavier use of |
Introduction
The calculation core is a header-only library in C++. In each build target of unit test, C API, validation test, etc, we have multiple translation units (
.cpp
files). The compilation speed is slow in both CI and local development machine. This is frustrating and slows down the development.Proposal
We would like to re-organize the headers in the header only library to reduce the dependencies between the headers. Hopefully we can increase the compilation speed. Possible ways of improvement can be:
power_grid_model.hpp
. Only keep the absolute common standard libraries (likecstddef
). Include the needed standard library in individual header files where it is needed.power_grid_model.hpp
, so that other headers can use the opaque type if the full type is not needed. This reduces the dependencies between the headers.type_traits
types to specify theinput
,update
, .. types of each component. In this way, when compiling meta-data (like serializer), we do not need to include all the component types, only the traiter types.MathSolver
a generic template class with supported solvers, just like how theMainModelImpl
is templated with the componentsusing
declarations likeusing MainModel = MainModelImpl<...>;
to separate header files, e.g.main_model.hpp
andmain_model_impl.hpp
. The tester of dispatch functionality of theMainModel
could then use a component-less instance.The text was updated successfully, but these errors were encountered: