2 ms·
I ran some more measurements using import std; with a properly built module that includes reflection. I first created the module via: g++ -std=c++26 -fmodul
by SuperV1234 7mo ago
I ran some more measurements using import std; with a properly built module that includes reflection.
I first created the module via:
g++ -std=c++26 -fmodules -freflection -fsearch-include-path -fmodule-only -c bits/std.cc
And then benchmarked with:
hyperfine "g++ -std=c++26 -fmodules -freflection ./main.cpp"
The only "include" was import std;, nothing else.
These are the results:
- Basic struct reflection: 352.8 ms
- Barry's AoS -> SoA example: 1.077 s
Compare that with PCH:
- Basic struct reflection: 208.7 ms
- Barry's AoS -> SoA example: 1.261 s
So PCH actually wins for just <meta>, and modules are not that much better than PCH for the larger example. Very disappointing.
- SuperV1234 7mo agoUpdate: I had originally used a Docker image with a version of GCC built with assertions enabled, skewing the results. I am sorry for that. Modules are actually not that bad with a proper version of GCC. The checking assertions absolutely crippled C++23 module performance in the original run: Modules (Basic 1 type): from 352.8 ms to 279.5 ms (-73.3 ms) Modules (AoS Original): from 1,077.0 ms to 605.7 ms (-471.3 ms, ~43% faster) Please check the update article for the new data.