logoalt Hacker News

epolanskitoday at 10:12 AM3 repliesview on HN

This sounds like great news, Zig's compilation times are already terrific and this is going to only make them better.


Replies

ozgrakkurttoday at 3:16 PM

Just creating a file with dummy test like

if (2 * 2 != 5) { @panic("fail"); }

And running `zig test file.zig -OReleaseSafe` takes a couple seconds on my computer. It also keeps taking the same amount of time every time I do it when I modify that file. Using 0.16 (or master) version so my toolchain isn't old and I'm on linux.

Zig is super nice to use as a language but the compiler/stdlib isn't developed conservatively enough imo.

You may not run into an issue like this when starting out with hello world but you will want to run optimized binaries for fuzz testing or benchmarking. And then it becomes super annoying considering you might be compiling a relatively small amount of code.

Just for comparison, imo Zig is a much better language than these other languages, but if you did something like this in Rust/C++/C etc. this kind of issues basically doesn't ever happen. Assuming clang/gcc/ninja etc. usage for C/C++.

I am able to use Ninja/Python/clang for configuring/building (-O2 or -O3)/testing ~10k loc C++ project in 200ms on the same computer for example.

show 1 reply
dmittoday at 10:24 AM

> Zig's compilation times are already terrific

In my experience, this (for now) is mostly aspirational. It's obviously a major goal, and there are clear milestones outlined on how to achieve it, but in practice the initial compile of an empty project or the excruciating pause when you `direnv allow` and ZLS needs to be (re)built are not what I'd describe as "terrific".

show 3 replies
pjmlptoday at 11:41 AM

Yes, compilation speeds of the 90's are slowly making a return, thankfully.

show 1 reply