Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

While LLVM certainly is a problem, consuming over 90% of compile times both for C3 and Odin, it should be noted that both languages compile MUCH faster than Zig, achieving in general sub second compile times while using LLVM and without incremental compilation. So the question could be asked: ”what is making Zig so slow to compile” as both languages have similar feature sets compared to that of Zig.


I should add that there are a few candidates:

1. Zig uses three(!) frontend IRs, Odin and C3 only one.

2. Zig relies heavily on comptime to provide most of its language features. C3, which has a similar set of features, doesn’t encourage excessive use of compile time and offers more features built into the language (for example format checking is a builtin, whereas in Zig it’s userland, even if C3 has the capability to do it like Zig). Although note that Zig only checks code directly traced, whereas C3 will check all code, and so will - esp for simple code - check much more code than Zig does.

3. Zig generates A LOT of code for even just a ”safe” Hello World.

On top of that, maybe there are just some other inefficiencies that hasn’t been addressed yet by the Zig team?

Even though I have stakes in the game I hope Zig gets faster. We need to move away from the illusion that Swift, C++ and Rust compilation speeds are anywhere near acceptable.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: