5 ms·
this! - the reason Zig defaults to one semantic analysis thread is due to current (to be improved) limitations; some ideas for Zig also will require one compila
by Retro_Dev 6d ago
this! - the reason Zig defaults to one semantic analysis thread is due to current (to be improved) limitations; some ideas for Zig also will require one compilation unit - the restricted function pointers proposal being a good example: https://github.com/ziglang/zig/issues/23367 https://github.com/ziglang/zig/issues/23367
The bun team tried to parallelize Zig's semantic analysis a while back - and it DID compile about 4x as fast... YET the builds were no longer deterministic, which is a hard requirement for lots of things. More effort will need to be spent here than naively adding a thread pool. Hopefully Zig's Sema.zig gets faster, but Rust is also super slow at compiling and needs to improve. Oh - one last thing to note, Zig has very fast debug compilation and incremental compilation, it's a real nice thing to work with that you simply can't approach in most other languages right now.
- lalitmaganti 6d ago> The bun team tried to parallelize Zig's semantic analysis a while back - and it DID compile about 4x as fast... I actually collected a build with multi-threading turned on [1]. It helped quite a bit, cutting the Zig object time from 7m49s to 4m05s. But because of the reason you mentioned (and the post was already so long!) I decided not to bring it up. > Oh - one last thing to note, Zig has very fast debug compilation and incremental compilation, it's a real nice thing to work with that you simply can't approach in most other languages right now. Yes, in fact I also tested just running bun run build / bun run build:release and captured traces for both! The clean release build took 3m36s for Zig versus 5m50s for Rust [2][3]. Clean debug was closer: 3m07s versus 3m27s [4][5]. I also tried incremental debug builds: adding a comment to output.zig / output.rs took 48.6s / 65.4s to rebuild. Ordinary developer builds certainly gave a different picture from CI. [1] https://buildprof.lalitm.com/#!/?url=https%3A%2F%2Fblogexamples.lalitm.com%2Fbuildprof-bun%2F2026-09-05-webkit-thinlto-shards4%2Fbun-zig-ci-webkit-thin-216858e177bb5687.buildprof https://buildprof.lalitm.com/#!/?url=https%3A%2F%2Fblogexamp... [2] https://buildprof.lalitm.com/#!/?url=https%3A%2F%2Fblogexamples.lalitm.com%2Fbuildprof-bun%2F2026-09-04%2Fbun-zig-release-clean-a0bce594d295e480.buildprof https://buildprof.lalitm.com/#!/?url=https%3A%2F%2Fblogexamp... [3] https://buildprof.lalitm.com/#!/?url=https%3A%2F%2Fblogexamples.lalitm.com%2Fbuildprof-bun%2F2026-09-04%2Fbun-rust-release-clean-ea901c0782671a10.buildprof https://buildprof.lalitm.com/#!/?url=https%3A%2F%2Fblogexamp... [4] https://buildprof.lalitm.com/#!/?url=https%3A%2F%2Fblogexamples.lalitm.com%2Fbuildprof-bun%2F2026-09-04%2Fbun-zig-debug-clean-215b2124a465e0b6.buildprof https://buildprof.lalitm.com/#!/?url=https%3A%2F%2Fblogexamp... [5] https://buildprof.lalitm.com/#!/?url=https%3A%2F%2Fblogexamples.lalitm.com%2Fbuildprof-bun%2F2026-09-04%2Fbun-rust-debug-clean-7bbc12503d93f059.buildprof https://buildprof.lalitm.com/#!/?url=https%3A%2F%2Fblogexamp...