https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125179
Bug ID: 125179
Summary: extremely slow build times with -freflection flag
Product: gcc
Version: 16.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: edoardo762 at gmail dot com
Target Milestone: ---
Created attachment 64365
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64365&action=edit
reflection flag patch
Hi, I've been experimenting with GCC 16 testing its reflection implementation
by compiling some code I had written targeting the pre standardization
implementation for reflection (tested on the clang compiler available at the
time).
Unfortunately by enabling the reflection features (-std=c++26 - freflection),
the compile times for my project plummet, it goes from compiling in 40 seconds
to compiling in 17 minutes (with non parallel builds).
These times were taken by building with GCC 16 packaged by Arch linux
But I have the same slow build times even with other distributions of GCC 16.
The project in question is https://github.com/edo9300/ygopro-core, it uses
premake5 to compile (and the extra flags can be added by applying the attached
patch).
This is the build config of the GCC 16 shipped by Arch linux
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure
--enable-languages=ada,c,c++,d,fortran,go,lto,m2,objc,obj-c++,rust,cobol
--enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues
--with-build-config=bootstrap-lto --with-linker-hash-style=gnu
--with-system-zlib --enable-cet=auto --enable-checking=release
--enable-clocale=gnu --enable-default-pie --enable-default-ssp
--enable-gnu-indirect-function --enable-gnu-unique-object
--enable-libstdcxx-backtrace --enable-link-serialization=1
--enable-linker-build-id --enable-lto --enable-multilib --enable-plugin
--enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-werror --disable-fixincludes
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.1.1 20260430 (GCC)