Skip to content

Improve editor tokenizer performance and benchmarking - #1028

Open
ije wants to merge 3 commits into
mainfrom
ije/improve-tokenizer
Open

Improve editor tokenizer performance and benchmarking#1028
ije wants to merge 3 commits into
mainfrom
ije/improve-tokenizer

Conversation

@ije

@ije ije commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Large files could synchronously build grammar state, remap cached states, and scan bracket caches during edits, delaying editor updates.

Time-slice state prebuilds, remap comparison states lazily, and truncate the bracket cache in constant time. Scope background messages per tokenizer and ignore unchanged theme notifications.

Add repeatable benchmarks and regression coverage for these paths.

Benchmark results

100,000 lines, 10 measured runs, 3 warmups; median timed-call latency:

Scenario Before After Improvement
Structural edit at line 0 114.947 ms 40.822 ms 2.82× / 64.5%
Deep state-prebuild kickoff 55.541 ms 0.039 ms 1,407× / 99.93%
Bracket-cache invalidation 16.782 ms 0.091 ms 185× / 99.46%
Unchanged theme mutation 0.089 ms 0.023 ms 3.80× / 73.7%
Cross-instance message dispatch 0.145 ms 0.025 ms 5.77× / 82.7%

Deep prebuild still performs the required grammar work, but distributes it across queued chunks instead of blocking the initiating call.

No-op theme updates now perform zero background restarts, theme applications, or callbacks. Background messages now trigger only their owning tokenizer.

ije added 2 commits July 27, 2026 19:51
Large files could synchronously build grammar state, remap cached states,
and scan bracket caches during edits, delaying editor updates.

Time-slice state prebuilds, remap comparison states lazily, and truncate
the bracket cache in constant time. Scope background messages per
tokenizer and ignore unchanged theme notifications.

Add repeatable benchmarks and regression coverage for these paths.
@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pierre-docs-diffs Ready Ready Preview Jul 27, 2026 12:28pm
pierre-docs-diffshub Ready Ready Preview Jul 27, 2026 12:28pm
pierre-docs-trees Ready Ready Preview Jul 27, 2026 12:28pm
pierrejs-diff-demo Ready Ready Preview Jul 27, 2026 12:28pm

Request Review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 835816319b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/diffs/src/editor/tokenizer.ts
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.

2 participants