I have a simple game that I’ve built in Odin with Raylib. I started rewriting it in Zig and one thing that surprised me is how slow the builds are, the delay was annoyingly noticeable on each compilation. I benchmarked it and I got ~700 ms on average to build the project in Odin vs ~1.7 secs in Zig.

I mainly work on Apple Silicon M1. I asked Loris about my problem during his twitch stream and he suggested to try the amd64 machine to see if it’s better. So I tried my old Thinkpad with i5-8365U CPU and the build times were even worse there - ~2 seconds on average. Loris has also mentioned the -fincremental flag, but it somehow paniced when I tried to use it (did not investigate exactly why). But even if -fincremental worked, IIUC it only works in the watch mode, which doesn’t really fit my workflow, as I usually just invoke the compiler via a keymap in Neovim.

I then got curious and built a similar prototype in Rust (using the Raylib crate) and while the initial build was much slower, the subsequent invocations were surprisingly much faster - ~300 ms (even 2x faster than Odin).

Why is zig build so slow? Will it be improved any time soon?