3 ms·
Zig did go on to apply the same style to their two later IRs, ZIR (https://github.com/ziglang/zig/pull/8266 https://github.com/ziglang/zig/pull/8266) and AIR (h
by Rusky 3y ago
Zig did go on to apply the same style to their two later IRs, ZIR (https://github.com/ziglang/zig/pull/8266 https://github.com/ziglang/zig/pull/8266) and AIR (https://github.com/ziglang/zig/pull/9353 https://github.com/ziglang/zig/pull/9353). These don't look as thoroughly benchmarked (at least not on the PRs) but it looks like they got significant wins there as well.
Of course Zig is a very different language and its compiler handles a rather different workload. It's totally possible that their approach makes more sense in younger codebases, or with a different source language design, or whatever else. But I also don't think node size tells the whole story- there's a synergy between memory usage, memory layout, and memory access patterns. For example Cranelift gets a lot of mileage from tweaking their algorithms in combination with their data structures, e.g. the "half-move" design mentioned in https://cfallin.org/blog/2022/06/09/cranelift-regalloc2/#performance https://cfallin.org/blog/2022/06/09/cranelift-regalloc2/#per...
- AndyKelley 3y agoWe also migrated all compile-time types and values to be stored in a similar fashion: https://github.com/ziglang/zig/pull/15569 https://github.com/ziglang/zig/pull/15569 Perf was a bit of a wash on this one but it means we can serialize most of the compiler's state with a single pwritev syscall. For a 300,000 line codebase, this data takes up 30 MiB and uses the same format on disk as in memory. On my laptop, 30 MiB can be written from memory to disk in 25ms. This is one puzzle piece for incremental compilation. More puzzle pieces are listed in the PR description here: https://github.com/ziglang/zig/pull/16917 https://github.com/ziglang/zig/pull/16917