Re:The hidden compile-time cost of C++26 reflection
by craftit on Tuesday March 10, 2026 @06:39AM
(#47321454)
I don't know the exact details, but I have heard (on C++ Weekly, I believe) that it offers some advantages when linking code compiled with different compiler versions. That said, I normally avoid it and use fmtlib to avoid the extra compile time. So it isn't clear if it is a win to me. Header-only libraries are great on small projects, but on large codebases with 1000's of files, it really hits you.
Re:The hidden compile-time cost of C++26 reflection
by surajrmal on Tuesday March 10, 2026 @09:36AM
(#47323076)
It also bloats binary size if you statically link libc++ because of localization, regardless if you care for it. This wasn't true for fmtlib because it doesn't support localization. stringstream has this same problem, but it's one of many reasons embedded has stuck with printf.
Re:The hidden compile-time cost of C++26 reflection
by vitaut on Monday March 16, 2026 @02:56PM
(#47403190)
The binary bloat is also caused by unnecessary inlining and the linker eliminates most of it (but it's still annoying e.g. for godbolt). {fmt} supports a superset of std::format and std::print features including localization. stringstream's bloat is unrelated and mostly caused by large per-call binary code from concatenation-based API.
Re:The hidden compile-time cost of C++26 reflection
by SuperV1234 on Tuesday March 10, 2026 @02:01PM
(#47326701)
The data was incorrect due to an oversight on my part (the Docker image I had used compiled GCC with internal assertions enabled).
Including <print> is still very heavy, but not as bad as before (from ~840ms to ~508ms)
Re:The hidden compile-time cost of C++26 reflection
by vitaut on Monday March 16, 2026 @02:52PM
(#47403128)
std::print author here. Indeed, std::print shouldn't be expensive to compile, it's just a thin wrapper around a single type-erased function. The only reason why it is expensive in libstdc++ is that the type-erased function is inlined which goes against the proposed design but unfortunately can't be enforced via the standard wording and remains a Quality of Implementation (QoI) issue.
Fortunately, libstdc++ is fixing this: https://gcc.gnu.org/pipermail/gcc-patches/2026-March/710275..... There is still more work to optimize the includes but it's a good start.
<meta> is another question, it depends on string_view, vector, and possibly other parts. Maybe it's possible to make it leaner with more selective internal deps.