Skip to content

perf!: regenerate the python parser for runtime 13 - #43

Merged
exKAZUu merged 1 commit into
mainfrom
perf/runtime-13
Oct 22, 2026
Merged

exKAZUu merged 1 commit into
mainfrom
perf/runtime-13

Conversation

@exKAZUu

@exKAZUu exKAZUu commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Why

WillBooster/tree-sitter v13.0.0 splits terminal and goto rows, packs each parse action into one word, stores default gotos for states that training never visits, and pops single-path reductions without the general stack walk. Runtime 13 rejects parsers generated for older ABIs, so this grammar must be regenerated with the v13.0.0 CLI to keep loading. Syntax trees are unchanged.

tree-sitter-python.wasm (--optimization z) Raw gzip -9
Published 9.0.0 (runtime 10) 411,830 B 84,172 B
This PR (runtime 13) 319,190 B 83,590 B
Change -92,640 B (-22.5%) -582 B (-0.7%)

src/parser.c shrinks from 1,301,842 B to 1,131,501 B.

Requirements

  • required: Improve both performance and binary size of tree-sitter and our grammar repositories as much as possible.
  • required: Backward compatibility can be ignored, and the current tree structure need not be kept.
  • required: For each PR, run review-booster, then complete-pr, then release.
  • chosen: Pin runtime 13.0.0 exactly in devDependencies and Cargo dev-dependencies, and ^13.0.0 as the npm peer dependency, because the parser carries ABI 0x57420009, which only runtime 13.x loads.
  • chosen: Bump the README's crate example to willbooster-tree-sitter-python 10, because this breaking change releases the next major version.

Customer Summary

The npm package and the crate now require @willbooster/web-tree-sitter / willbooster-tree-sitter 13.0.0 or later within 13.x; older runtimes refuse to load the parser. The shipped Wasm is 22.5% smaller. Parse results are the same.

Technical Summary

  • src/parser.c and src/tree_sitter/parser.h are regenerated by script/generate (profile-guided) with the v13.0.0 CLI; regenerating twice produces identical output.
  • package.json, bun.lock, Cargo.toml, and Cargo.lock lock runtime 13.0.0; script/runtime-version prints 13.0.0.
  • README.md and bindings/rust/lib.rs state the new runtime requirement and docs.rs link.

Testing

  • bun run verify: passed (code-gauge reports only pre-existing violations outside this change).
  • bun wb test: 22 files, 39 tests passed (node and browser projects, including Wasm, workerd, corpus, examples, incremental, and performance tests).
  • cargo test --locked: passed.
  • PR CI (Test, Test Rust, Robustness fuzz and multi-platform tests): passed.

Regenerate the parser with the WillBooster/tree-sitter v13.0.0 CLI and require
runtime 13.0.0 (ABI 0x57420009) in npm, Cargo, and documentation.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
@exKAZUu exKAZUu self-assigned this Oct 22, 2026
@exKAZUu
exKAZUu merged commit 686abce into main Oct 22, 2026
10 checks passed
@exKAZUu
exKAZUu deleted the perf/runtime-13 branch October 22, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant