Optimizing C++/Code optimization/Compile time optimization
From Wikibooks, open books for an open world
- When possible put code that is reused into .cpp files and compile as reusable libraries instead of placing more code in header files to minimize the amount of redundant compilation.
- Use templates to speed up compile time by compiling the parts of the interface that you use rather than compiling every possibility all the time, one particular use case here is for macros.
- Minimize included code to only include the exact features you need, rather than using catch all include files
- Use forward declarations to avoid including files because it completely eliminates redundant compilation of code.