https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125328
Bug ID: 125328
Summary: Compilation performance regression in GCC 16 compared
to 15, especially with import std;
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: boris at kolpackov dot net
Target Milestone: ---
I ran a benchmark on GCC 16.1.0 and 15.2.0 (both from Debian, compiled with
--enable-checking=release) and found GCC 16 being quite a bit slower in C++
compilation speed (no optimization), especially with `import std;`.
The benchmark compiles (in parallel) 128 translation units each of which
includes `<iostream>`, imports `std`, or imports `<iostream>` and calls
`std::cout << 123;`. Note that compilation of the `std` module or `<iostream>`
header unit is excluded from the measurement. In other words, this tries to
measure the compilation speed in a realistic development setup.
Here are the numbers for GCC 16 and 15 (the absolute values are not important
but they were obtained on i9-12900K):
include-hdr import-std import-hdr
--------------------------------------------
GCC 16 5.55s 2.71s 1.02s
GCC 15 4.95s 2.15s 1.06s
So in this benchmark, GCC 16 is 12% slower on `#include <iostream>` and 26% (!)
slower with `import std;`.
The benchmark (with instructions) is available here:
https://github.com/boris-kolpackov/libenum-to-string-bench