Date: Sat, 16 May 2026 23:47:20 +0100
On Sat, 16 May 2026, 21:59 Adrian Johnston via Std-Proposals, <
std-proposals_at_[hidden]> wrote:
> Hello Std Proposals,
>
> I have been benchmarking the cost of including the standard library
> headers alone without actually using anything in them. This is because it
> is common for large C++ programs to end up with headers that have massive
> include graphs that slow down compilation considerably. Even when the
> individual translation units use only a small fraction of what is included
> in them.
>
> The executive summary is that the compile time costs incurred by using the
> standard library have roughly doubled between C++11 and C++23. Simply
> changing the standard library in use on the command line could add 0.5-1.0
> seconds to the compile time for each file in your project. This is because
> of the surprising amount of additional code that gets included when you
> change language standards.
>
> Even the cost of loading the standard library as a PCH has been going up
> and it could still add up to a considerable amount of time across hundreds
> of files.
>
> I would like to strongly discourage adding more code to existing headers
> in future standards.
>
> As for floating a proposal on this list, having things like <algorithm-core>
> that includes only the contents of <algorithm> as defined by C++11 would
> be a way to cut back. I can't say there are any clean and satisfying
> solutions that come to mind right now.
>
> Here is the script I used to generate the following document if you want
> to check my methods:
> https://github.com/whatchamacallem/cxx-std-include-bench The script and
> the following documents are also attached to this email.
>
> Regards,
> Adrian
>
>
>
> Benchmarking Including The C++ Standard Library
>
> All timings are the median of 51 runs. Timings collected on an MSI Stealth
> A16 AI+ A3XVFG.
>
> This script measures the compilation overhead of including but not using a
> large set of the C++ standard library headers with GCC and Clang for C++11,
> C++14, C++17, C++20, and C++23. Nothing in the headers is actually used.
> Startup time is the time taken to compile an empty file with no includes at
> all and is deducted from all subsequent measurements. GCC uses libstdc++
> and Clang uses libc++.
> Compiler Version Startup (ms)
> GCC g++ (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0 6
> Clang Ubuntu clang version 18.1.3 (1ubuntu1) 15
>
These are both outdated, unsupported releases, without full C++20 or C++23
support.
You're going to faint when you see the size of <vector> in GCC 16 for C++26.
>
std-proposals_at_[hidden]> wrote:
> Hello Std Proposals,
>
> I have been benchmarking the cost of including the standard library
> headers alone without actually using anything in them. This is because it
> is common for large C++ programs to end up with headers that have massive
> include graphs that slow down compilation considerably. Even when the
> individual translation units use only a small fraction of what is included
> in them.
>
> The executive summary is that the compile time costs incurred by using the
> standard library have roughly doubled between C++11 and C++23. Simply
> changing the standard library in use on the command line could add 0.5-1.0
> seconds to the compile time for each file in your project. This is because
> of the surprising amount of additional code that gets included when you
> change language standards.
>
> Even the cost of loading the standard library as a PCH has been going up
> and it could still add up to a considerable amount of time across hundreds
> of files.
>
> I would like to strongly discourage adding more code to existing headers
> in future standards.
>
> As for floating a proposal on this list, having things like <algorithm-core>
> that includes only the contents of <algorithm> as defined by C++11 would
> be a way to cut back. I can't say there are any clean and satisfying
> solutions that come to mind right now.
>
> Here is the script I used to generate the following document if you want
> to check my methods:
> https://github.com/whatchamacallem/cxx-std-include-bench The script and
> the following documents are also attached to this email.
>
> Regards,
> Adrian
>
>
>
> Benchmarking Including The C++ Standard Library
>
> All timings are the median of 51 runs. Timings collected on an MSI Stealth
> A16 AI+ A3XVFG.
>
> This script measures the compilation overhead of including but not using a
> large set of the C++ standard library headers with GCC and Clang for C++11,
> C++14, C++17, C++20, and C++23. Nothing in the headers is actually used.
> Startup time is the time taken to compile an empty file with no includes at
> all and is deducted from all subsequent measurements. GCC uses libstdc++
> and Clang uses libc++.
> Compiler Version Startup (ms)
> GCC g++ (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0 6
> Clang Ubuntu clang version 18.1.3 (1ubuntu1) 15
>
These are both outdated, unsupported releases, without full C++20 or C++23
support.
You're going to faint when you see the size of <vector> in GCC 16 for C++26.
>
Received on 2026-05-16 22:47:37
