Show HN: A C++ Compiler That Is Faster Than GCC and Clang

Posted by vishvananda 1 day ago

Counter8Comment3OpenOriginal

I've been working on a scaffold to teach an agent how to build a self-hosting C++ Compiler from scratch for the past 6 months. One of my recent agent-runs recently achieved self-hosting for less than $500 in API tokens, but the most interesting part is that the reference implementation (which takes the best ideas from every run) can now compile C++ code 4x faster than GCC and Clang.

Comments

Comment by spacedcowboy 1 day ago

Whereas this is very impressive, I feel “faster than” should be called out as “faster to compile than”. It’s generated code seems “on a par with”.

Comment by vishvananda 1 day ago

Yes, agreed. "Faster to compile" can also be interpreted as the time to compile the compiler itself, so rather than try to disambiguate in the title, I just went with the short version.

The breakdown is roughly:

* Compiling a TU (Unoptimized): ~2.5x

* Compiling a TU (Optimized): ~4x

* Generated Code Speed (Unoptimized): ~1.01x

* Generated Code Speed (Optimized): 0.99x

Comment by spacedcowboy 14 hours ago

Oh I appreciate you were totally up-front with the numbers in the post, didn’t mean to imply otherwise. I just think “X is faster” when referring to compilers generally means the resulting executables are faster - maybe that’s just me :)

I use ‘faster’in that sense with my own compiler… https://news.ycombinator.com/item?id=50380978