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
Split panes of the same combined Changes section share one text snapshot for each model event, while both panes still retain their drafts and dirty state.
What Changed
Extract the synchronous actual-model/version snapshot reader introduced by #34920 and reuse it in DiffSectionItem. Each publisher still runs; the first reads the text, later publishers reuse it, and a microtask releases it. This draft is based on #34920 to reuse that implementation.
Why
With ten panes on one actual combined-diff model, typing, Undo and Redo each read the same full document ten times for publication. They now read it once. Wrapper equality reads are covered separately by #35017; a two-pane probe atop that exact published head independently reproduced the remaining two publication reads.
Linked Issue
Internal editor performance audit; no existing issue.
Visual Proof
N/A — both section drafts, dirty state and presentation are preserved. This removes duplicate text reads during synchronous delivery.
Testing
Ten real-model/installed-wrapper cases pass across the source and combined-section publisher paths.
One- and ten-pane edit/Undo/Redo controls retain every section publication; teardown stops reads. The ten-pane count regression fails before the fix.
Existing source controls cover separate models, nested publisher edits, programmatic synchronization, paste and retired owners.
Actual model identity and version bound reuse; content survives only through synchronous delivery and is released by microtask. Existing workspace/model routing is retained. Native macOS/Windows, physical mobile and live SSH were not executed. Counts establish avoided reads; CPU, latency and heap impact were not measured.
Agent skill upstream boundary
Not applicable; no upstream skill-installer content copied.
Closing after an adversarial review pass (correctness + value lenses, judged per cluster).
Closing. This spreads #34920's version-keyed WeakMap/microtask snapshot cache into the combined-diff publication path to skip one getValue() per extra pane per keystroke. That only happens when the same worktree's combined-diff section is mounted and edited in two or more split panes, and each pane still does its own compare, setSections, re-render and diff-worker recompute. No CPU, latency or heap numbers were measured. Under #27143 a shared mutable cache across panes in the draft/dirty path is not a free win, and this one is not substantial. The cache is also being removed from the parent #34920, so this PR has nothing left to build on. The 280-line test is a mock-heavy getValue call-count harness.
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
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.
ELI5
Split panes of the same combined Changes section share one text snapshot for each model event, while both panes still retain their drafts and dirty state.
What Changed
Extract the synchronous actual-model/version snapshot reader introduced by #34920 and reuse it in
DiffSectionItem. Each publisher still runs; the first reads the text, later publishers reuse it, and a microtask releases it. This draft is based on #34920 to reuse that implementation.Why
With ten panes on one actual combined-diff model, typing, Undo and Redo each read the same full document ten times for publication. They now read it once. Wrapper equality reads are covered separately by #35017; a two-pane probe atop that exact published head independently reproduced the remaining two publication reads.
Linked Issue
Internal editor performance audit; no existing issue.
Visual Proof
N/A — both section drafts, dirty state and presentation are preserved. This removes duplicate text reads during synchronous delivery.
Testing
pnpm check:changed --maxWorkers=2: all 21 checks passed in 183.6s (ORCA_BACKGROUND_LAUNCH=1; gate includes the Admit source content events before reading and share pane snapshots #34920 stack).Review
Actual model identity and version bound reuse; content survives only through synchronous delivery and is released by microtask. Existing workspace/model routing is retained. Native macOS/Windows, physical mobile and live SSH were not executed. Counts establish avoided reads; CPU, latency and heap impact were not measured.
Agent skill upstream boundary