Remove <string> includes in headers to improve build time #1840
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.
The
<string>
header was inclass_db.hpp
andmethod_bind.hpp
even though no parts of it are used in either of those files. I also removed the<iostream>
header from class_db.hpp because it was also unused. Both of these files ended up getting included in thousands of other cpp files so slowed down build time a lot.There seem to be only 2 uses of code from
<string>
in godot-cpp as the code works now:I did 2 test runs where I ran with ClangBuildAnalyzer and the
time
command then didscons --clean
. These are the timings I got before and after making these changes:Without these changes
Executed in 108.61 secs
Executed in 107.91 secs
**** Time summary:
Compilation (1025 times):
Parsing (frontend): 1701.6 s
Codegen & opts (backend): 187.1 s
With these changes
Executed in 97.04 secs
Executed in 91.19 secs
**** Time summary:
Compilation (1025 times):
Parsing (frontend): 1393.1 s
Codegen & opts (backend): 181.2 s