Zig Proposal to Drop LLVM
Loris Cro and Andrew Kelley (in 2020):
In the early days, Zig was but a thin frontend in front of LLVM. This was instrumental for getting started quickly and filling in gaps of Andrew’s knowledge as a compiler developer. Now, the training wheels of the bicycle are coming off, and LLVM is transitioning into an optional component.
[…]
The move to a self-hosted compiler for Zig has similar advantages for the core contributors, but it also makes LLVM an optional dependency, increases compilation speed (instead of losing it), and adds an amazing feature for debug builds of your code: incremental compilation with in-place binary patching, another unique Zig feature.
Andrew Kelley (via Hacker News):
This issue is to fully eliminate LLVM, Clang, and LLD libraries from the Zig project.
[…]
In exchange, Zig gains these benefits:
- All our bugs are belong to us.
- The compiler becomes trivial to build from source and to bootstrap with only a C compiler on the host system.
- We stop dealing with annoying problems introduced by Linux distributions and package managers such as Homebrew related to LLVM, Clang, and LLD. There have been and continue to be many.
- The Zig compiler binary goes from about 150 MiB to 5 MiB.
- Compilation speed is increased by orders of magnitude.
- We can implement our own optimization passes that push the state of the art of computing forward.
- We can attract research projects such as alive2
- We can attract direct contributions from Intel, ARM, RISC-V chip manufacturers, etc., who have a vested interest in making our machine code better on their CPUs.
At least initially, Zig would lose support for C++ and Objective-C, along with less popular architectures.
Aryan Ebrahimpour (via Hacker News):
The Zig programming language has garnered considerable attention as a new systems programming language, positioning itself as the better C. But how does Zig achieve this? In this blog post, our aim is to examine some of the issues associated with C and explore how Zig intends to address them.
Previously:
1 Comment RSS · Twitter · Mastodon
ncdu is an essential command line tool and version 2 was a complete rewrite in zig. Installing via home-brew on 10.14 installs LLVM, which also has a number of dependencies. I'm so looking forward to when this installation is simplified by a smaller compiler.
Alas zig requires Big Sur now and doesn't run on 10.14 anymore, so no ncdu there, too.