Performance Improvements
Module graph construction is now 3000x faster! 🚀
Dramatically improved module graph build performance through two key optimizations:
Before: ~1850ms to analyze build.zig (loading 308 modules from std with ZIR)
After: ~0.6ms to analyze build.zig (loading 2 modules without ZIR)
What changed:
-
Disabled ZIR generation - ZIR was added proactively in v0.4.0 for future control flow analysis (issue #18), but no rules currently use it. Generating ZIR took 10-50ms per module.
-
Skip recursing into std library - When linting user code like
build.zig, we don't need to parse all 300+ modules from the standard library. Now we only load the rootstd.zigfile.
Impact on real-world usage:
# Linting a single file that imports std
Before: ~2 seconds
After: ~0.4 seconds (5x faster)
# Linting entire src/ directory
Before: Previously slow on large projects
After: Dramatically faster startup and analysisThese optimizations can be easily reverted if control flow analysis is implemented in the future (see well-documented code comments in src/ModuleGraph.zig).
Technical Details
- ZIR generation infrastructure remains in place and can be re-enabled by uncommenting documented code sections
- Module graph now loads only user code + top-level std.zig instead of recursively parsing the entire standard library
- All tests pass; linter functionality unchanged
- Verified against GitHub history: ZIR added in commit 14bbe87 but never used by any rules
Installation
mise use github:rockorager/ziglint@v0.5.2Or download pre-built binaries from the release assets.