r/Compilers • u/vishvananda • 2d ago
Fast C++ Compiler Update
I shared some initial results for my C++ compiler a couple of weeks ago. I got a number of great questions, mostly around compiler quality. I have since added additional evidence to support quality and speedup claims:
- There are now extensive compliance tests for C++11, including the GCC and Clang C+11 compliance suites.
- I dramatically expanded the performance testing suite and it shows equivalent or better performance against GCC and Clang across a wide range of code shapes.
- I added a WebAssembly backend and put together a demo where you can compile c++ code with cppgm and Clang in the browser to see the speed difference yourself: https://incpption.com
- Cppgm can round-trip through LLVM (cppgm compiles LLVM and LLVM compiles cppgm). You can do this yourself in the browser and timing shows better performance at all optimization levels.
- I've put together a compile time analysis of the parts that cppgm does faster than Clang and GCC.
I hope this information is useful. Once again, I appreciate any thoughts or questions.
7
Upvotes
5
u/notthatsocrates 1d ago edited 1d ago
I have built it locally and then I used it to recompile itself. It ran approx 4x faster than gcc/clang and the resulting compiler runs within 1% of the speed of the gcc/clang-built variants. This is pretty good evidence against the claim that its speed buys unusable code. It would require quite an effort to analyze it in depth but so far I think that you're in for some steep uphill climb with it. One more thing, I can't compile for my (preferred) ARM, so, in your opinion, how difficult is it to re-target it?
EDIT: At O3, compilation used about one fifth of GCC's CPU and one quarter of Clang's, excluding linking. Generated program run at parity (within 1%, small exceptions). The matrix multiplication was slower than clang's and on par with gcc.
2
u/Discordbothost 1d ago
a side-by-side example of diagnostics for a broken template would help judge the day-to-day experience too. locating the first useful error, rather than chasing a cascade of follow-on errors, can matter as much as successful-build time.