-
Notifications
You must be signed in to change notification settings - Fork 452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optimize template instantiations #239
Comments
It's hard to get good benchmarking results. Probably a good idea to run the compiler directly and a couple of times to filter the results, with something like (WPA profile): @rem build PCH etc
devenv test.sln /build
@rem ensure warm file cache
cl /c -Yucmake_pch.hxx -Fpcmake_pch.pch -FIcmake_pch.hxx -w test.cpp
vcperf -start -level3 MyVCSession
for /L %%i in (1,1,5) do cl /c -Yucmake_pch.hxx -Fpcmake_pch.pch -FIcmake_pch.hxx -w test.cpp
vcperf -stop -templates MyVCSession build.etl
wpaexporter build.etl -profile instantiations.wpaProfile -delimiter "\t"
type "C++_Build_Insights_-_Template_Instantiations_My_Stats.csv" For example, baseline:
|
|
What else can we do to optimize? |
Indeed, see #227. |
Another optimize: removed unnecessary array copying |
own lightweight string_view implemented |
Someone posted an interesting idea of using the debug mode code size as a proxy metric to optimize template instantiations. Something like that could also be easily tracked via Github Actions. |
Wow! Thanks for sharing |
Template instantiations still cause long compile-times even for simple projects, as already identified in #219 (comment).
https://devblogs.microsoft.com/cppblog/profiling-template-metaprograms-with-cpp-build-insights/
This is using current master, so includes #227.
The ideas mentioned there (custom string_view class and single function instantiation) are worth pursuing.
And using hard-coded offsets potentially (#219 (comment)).
The text was updated successfully, but these errors were encountered: