[Semi-OT]: Sub-Millisecond Compilations with Zig's In-Place Binary Patching

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Tue Sep 29 09:15:18 UTC 2020


On Tuesday, 29 September 2020 at 07:59:17 UTC, Jacob Carlborg 
wrote:
> This is looks pretty darn awesome. The Zig self-hosted compiler 
> (which is far from complete in terms of language support) seems 
> to be really fast. In the Zig compiler written in C++, most 
> time is spent in LLVM optimizing and generating code. In the 
> self-hosted compiler, everything is written in Zig: the 
> frontend, the backend and linker.

I think it is a mistake to focus on raw batch compilation speed 
though. What matters most is what kind of feedback you get while 
editing your code. Decent programmers that complicated languages 
like D/C++/Rust appeal to don't need to iterate that frequently 
in terms of batch-compilation (which also can be sped up by using 
a cluster if it really matters). Yes, I am aware that many will 
argue that it is very beneficial during testing, but I'd argue 
that if you cannot run tests in parallell, then maybe they should 
be written differently. CPU prices are going to fall faster than 
the labour it takes to rewrite a compiler from scratch and so are 
cloud computing solutions...

Where it does matter most is when you get fast compilation in 
combination with hot patching of running programs, like with 
Dart. Zig appears to be able to do that too using "hot swapping", 
but I have not tried Zig yet.



More information about the Digitalmars-d mailing list