r/cpp • u/tartaruga232 MSVC user, r/cpp_modules • May 26 '26
[std-proposals] Benchmarking using the standard library as a module
https://lists.isocpp.org/std-proposals/att-18441/attachmentSome interesting benchmarks that were posted on the [std-proposals] mailing list.
The link to the entry in the mailing list archive of [std-proposals]:
https://lists.isocpp.org/std-proposals/2026/05/18441.php
For comparison:
For our modularized Windows app1, we see a reduction in build time for a full build from ~3 to ~2 minutes due to using "import std"2.
1Using the MSVC compiler with MSBuild. We currently have 1148 C++ source files, 558 containing "export module". We have 4223 imports, 357 of these are "import std".
2A while ago (~2 months), I made an experimental branch in our (closed) source code repository, which replaces every single "import std" with the minimally required #includes of the standard library headers. That was done in our fully modularized code base.
View all comments
6
u/scrumplesplunge May 26 '26
Another thing worth noting is that the speedup also depends on what you actually use, too. If you use something template heavy, parsing matters less. As an example:
If I touch this file and rebuild it on my machine, it takes about 100ms on average.
This one takes 300ms:
This one takes 980ms:
This one takes 1250ms:
If I replace the
import stdwith four#includedirectives in that last example, it takes 1650ms. Modules are only shaving off 25% there.(timing taken with cmake 4.3.1, ninja 1.13.2, gcc 15.2.1)