You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upgrade to Zig 0.16.0; Fix tree-sitter panic issues
Update all APIs and dependencies for Zig v0.16.0
Update tree-sitter to resolve panic issues: Disable address sanitizer
for non-debug builds, and properly handle errors with `ts_stack_merge`
to prevent runtime panics.
perf: use smp_allocator instead of init.gpa
When the binary links libc (due to tree-sitter), init.gpa resolves to
std.heap.c_allocator rather than smp_allocator. The c_allocator is
significantly slower for the many small, short-lived allocations made
during markdown parsing, causing ~10-20% more CPU cycles. Explicitly
using smp_allocator restores performance parity with the 0.15.x build.
Also clean up the file-reading path: replace the Writer.Allocating +
empty-buffer reader with a proper 4096-byte buffer + allocRemaining,
which avoids the unbuffered zero-length read path.
perf: cache compiled TreeSitter queries per language
ts_query_new dominates render time (~97% of CPU). Previously it was
called on every code block, even for the same language. Add a
compiled_queries map to ts_queries that lazily compiles and caches
each language's query on first use; subsequent renders retrieve the
cached *Query in O(1).
syntax.getHighlights() now calls ts_queries.getCompiledQuery() directly,
eliminating the per-call Query.create()/destroy() pair. For documents
with repeated same-language blocks this makes dev/zig-16 ~3% faster
than main; for unique-language documents it avoids the overhead on any
second pass through the same file.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
0 commit comments