Repository navigation
perf(editor): speed up repeated edits - #267
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Dot-repeat, macros, counted edits, and visual-block replay were rebuilding frames and publishing document changes for individual replayed characters. A short repeat could therefore perform over a hundred full renders, while block insertion constructed thousands of hidden scratch frames.
Changes
Results
Local release samples on macOS arm64, with 2,000 Rust lines and trace instrumentation:
Dot renders and LSP notifications fell from 130/128 to 1/1. Full-sync repeat payload fell from 4.75 MB to 37 KB. These are diagnostic samples, not CI timing thresholds. See
docs/performance-edit-replay-2026-08-17.mdfor the complete comparison and retained scope decisions.How to Test
cargo build --locked --release -p red --bin red, then runpython3 scripts/edit_replay_bench.py --binary target/release/red. All eight scenarios should save the exact expected text; short dot/macro replay should publish one final frame.--plugins --split --scenario dot --scenario block, then with--lsp incremental --unicode --crlf. Repeat with--lsp full --scenario dot --scenario undo. Shared views must agree, and the local LSP fixture must reconstruct the document exactly with increasing versions.:register a irepeat-me-repeat-me-repeat-me-<Esc>, then5000@aand press Ctrl-C while it runs. Expect Normal mode andreplay interrupted;uand Ctrl-r must undo and restore the partial insertion without damaging the original text.Validated at
5050e50: 2,784 tests passed, one ignored; strict all-target/all-feature Clippy and format checks passed. The retained smoke also passed 42 before/after PTY cases and six manual checks, including shared splits and cancellation undo/redo. Protocol coverage uses a deterministic local server, not every production language server.