-
Notifications
You must be signed in to change notification settings - Fork 43
Closed
Labels
improvementImprovement on internal implementationImprovement on internal implementation
Description
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:
- Remove most of the standard library include in the main file
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. - Forward declare classes in the main file
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. - Use separate header file with
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. - Make the
MathSolver
a generic template class with supported solvers, just like how theMainModelImpl
is templated with the components - Move generic template class
using
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.
Metadata
Metadata
Assignees
Labels
improvementImprovement on internal implementationImprovement on internal implementation
Type
Projects
Status
No status