Fast iteration is the key to developer happiness. 🚀

I took a very early look at C++26 Reflection in GCC 16 to see if it would ruin my "fast compile" workflow.

Here are my findings!
https://vittorioromeo.com/index/blog/refl_compiletime.html

#cpp #gamedev #programming

the hidden compile-time cost of C++26 reflection

Article/tutorial on http://vittorioromeo.com

RE: https://mastodon.gamedev.place/@vittorioromeo/116183303954120361

I made a mistake in my original benchmarks: the Docker image I used had internal GCC assertions enabled.

I re-measured everything on a proper build, and times are ~50% faster across the board. The article has been updated with the correct data.

I apologize for the confusion.

@vittorioromeo It happens, but thank you for handling the correction well.
@thesamesam Thank you. Luckily, the conclusions/insights didn't really change much.
@vittorioromeo What happens if you use the standard library modules? e.g. import std;
Would be really interesting to see, as that is supported since GCC 15. You'll need to add -fmodules.
@meetingcpp @vittorioromeo Another interesting question is how this compares to libraries like boost.pfr or reflectcpp.

@vittorioromeo
Couldn't agree more with the sadness that @foonathan s proposal didn't make it. I just realized that we must wait for at least C++29 until we can use reflection on freestanding targets, because of the insistence on using `std::vector` in the interface.

edit: "Couldn't agree **more**"

@vittorioromeo "rewriting range-based code like std::views::transform or std::views::iota to good old boomer loopsâ„¢"

'Boomer Loops' did me in. :)

@vittorioromeo
I think the C++ community would get the best benefit out of the next standard if they'd clean up these awful standard library headers.

Yes, modules to the rescue, but it's actually a workaround for bad header design...

#cpp

@DanielaKEngert
Of course modules are much more than that!

I meant that "just use modules" as a reply to bad compile times would be the workaround.
@vittorioromeo

@dermojo @vittorioromeo

So far, I haven't seen any other/better solution than just wishful thinking.