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

Jacob Carlborg doob at me.com
Tue Sep 29 07:59:17 UTC 2020


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.

It seems it supports incremental compilation of the semantic 
phase, the code generation and the linking phase. It doesn't seem 
like it's currently using incremental lexing or parsing. It 
doesn't even need to relink everything, it just patches the 
executable in-place.

This results in an incremental build taking around 0.5 
milliseconds. Here's a video showing this feature [1].

This is something that D should have, including incremental 
lexing and parsing as well. It's also a reason to keep the DMD 
backend.

[1] https://www.youtube.com/watch?v=R5FKgi9BYyU

--
/Jacob Carlborg


More information about the Digitalmars-d mailing list