C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Benchmarking Including The C++ Standard Library

From: Jonathan Grant <jgrantonline_at_[hidden]>
Date: Fri, 22 May 2026 11:08:09 +0100
On 22/05/2026 02:14, Adrian Johnston via Std-Proposals wrote:
>
>>> But reorganizing headers at all seems kind of backwards when we have modules.
>
> The reality is that our current compilers still need to take the time to update their internal symbol tables with the entire contents of the module, so writing *import std;* might just kill the compile time of a large project across hundreds of files. It would make more sense to import only the standard library submodules needed as that might be faster. So we still have the problem, it is just less bad in some cases now.
>
> I spent a lot of time refactoring my codebase to work as a module after the response on this list and it loads slower than the textual inclusion of select headers. So I'm kind of burnt out on the topic after that, but I can do more benchmarking if anyone would like me to.
>
> I am not really suggesting breaking up headers at this point. Although it is pretty mind blowing what GCC pulls in when you include <math.h> in C++ on its own.
>

It's a common frustration.

Headers are modular for maintainability, and then they often end up all included by the preprocessor. I don't think there is a good solution, otherwise it would have been already done. Someone might write a simple wrapper object for math they really need and don't need anything from math.h? Then their little header won't include <math.h>

Lots of little files are also time consuming to compile, I recall Chromium took me 16+ hours to compile.

Jonathan

Received on 2026-05-22 10:08:12