[Bug c++/125329] Compilation performance of C++ reflection slower with `import std;` than with header inclusion
boris at kolpackov dot net
gcc-bugzilla@gcc.gnu.org
Mon May 18 07:40:46 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125329
--- Comment #2 from Boris Kolpackov <boris at kolpackov dot net> ---
> Is that exactly the difference you'd get with otherwise empty TUs (besides the #include/import)?
No, with empty TUs, `import std;` becomes much faster:
include-hdr import-std import-hdr
--------------------------------------------
GCC 16 2.82s 0.47s 0.57s
Feels like there has to be some lazy/on-demand name lookup for modules so that
if a name is not used by a TU, then it doesn't incur any overhead.
More information about the Gcc-bugs
mailing list