-
Notifications
You must be signed in to change notification settings - Fork 10.7k
[FR]: Improve compilation time by minimizing inclusions of <ostream>, <string>, and <vector> #4943
Copy link
Copy link
Open
Labels
Description
Does the feature exist in the most recent commit?
No.
Why do we need this feature?
GTest is the main compilation time bottleneck in our codebase.
Describe the proposal.
Our codebase has around ~700 unit test translation units that include gtest/gtest.h. We are suffering from slow compilation and CI times.
Profiling via ClangBuildAnalyzer shows the following heavy includes:
802664 ms: external/toolchains_llvm++llvm+llvm_toolchain_llvm/include/c++/v1/ostream (included 5982 times, avg 134 ms), included via:
717x: gtest.h
...
696285 ms: external/toolchains_llvm++llvm+llvm_toolchain_llvm/include/c++/v1/string (included 7443 times, avg 93 ms), included via:
252x: gtest.h
...
591285 ms: external/toolchains_llvm++llvm+llvm_toolchain_llvm/include/c++/v1/vector (included 6843 times, avg 86 ms), included via:
486x: gtest.h
...
Would it be possible to internally minimize the use of these headers? For example, <ostream> could be replaced with <iosfwd> in a few headers, and potentially isolated to .cpp files.
<string> could be conditionally replaced with <string_view> or even C-style strings, and <vector> could be conditionally be replaced with bespoke containers.
Is this something the GTest team is willing to consider?
Thanks.-
Is the feature specific to an operating system, compiler, or build system version?
No.
Reactions are currently unavailable