Move always.h from headers to cpp files #1121
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change aims to further reduce compile times.
On my machine with SSD, this reduces compile time in Debug configuration by 1 second - from 42 seconds to 41 seconds.
Disadvantage of this change
Most headers will no longer compile on their own when included in a cpp file. Every cpp file now needs to have always.h included at the very top. Our clang-format already sorts it that way.
Advantage of this change
This principle causes less file includes and a bit faster compilation.
Also, it allows the project to use precompiled headers moving forward. For next steps, we can move always.h into a stdafx.h, and then bundle it with some other hot files such as xfer.h and asciistring.h, and include stdafx.h instead of always.h in all cpp files.
https://en.wikipedia.org/wiki/Precompiled_header