Skip to content

perf(editor): highlight only affected code blocks - #253

Merged
SWBaek merged 1 commit into
mainfrom
perf/247-incremental-lowlight
Sep 7, 2026
Merged

perf(editor): highlight only affected code blocks#253
SWBaek merged 1 commit into
mainfrom
perf/247-incremental-lowlight

Conversation

@SWBaek

@SWBaek SWBaek commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Summary

Editing one code block in a 250-block document previously re-highlighted all 250 blocks; formatting a paragraph did the same. The shared editor now maps unchanged syntax spans and highlights only affected blocks, with a full rebuild for unknown step implementations. Code edits make one highlight call and paragraph mark edits make zero.

Adds full-build oracle coverage for language changes, paste/delete, nested wrapping/lifting, split/join, Undo/Redo, composition and same-text replacement. Adds npm run perf:browser -- --scenario=lowlight for actual Chromium keyboard measurements. Before/after samples show dispatch medians of 70.2 → 57.5 ms for code input and 67.3 → 53.0 / 80.8 → 55.5 ms for paragraph scenarios. Non-ordinary transactions still scan the document; timing is local evidence rather than a new latency guarantee.

Closes #247.

Validation

  • npm run check / npm run verify:fast (909 tests)
  • npm run build:all (through verify:all)
  • npm run verify:all — fast checks, builds, 73 Chromium UI tests, VS Code Extension Host, VSIX and CLI packaging
  • npm run perf:browser -- --scenario=lowlight — 2 warmups + 7 measured edits per scenario, call-count gates pass
  • Tests cover the changed editor behavior with fresh full-build decoration oracles and real Lowlight tokens

Additional ordinary rich-mixed-5k timing gate: failed locally on both base and PR (input p95 61.8 / 58.1 ms vs 50 ms). The same-harness comparison shows no observed regression; the threshold remains unchanged.

Contribution rights

  • I have the right to submit this work under the repository's MIT license.
  • The change contains no credentials, personal data, or unapproved proprietary assets.

@SWBaek SWBaek left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Independent Astra review of commit 1741332: no blocking findings; ready to merge.

This review was performed by a different Astra agent from the implementer, using the same repository owner's GitHub identity. It is recorded as a comment review, not represented as approval by a separate GitHub account.

Reviewed the complete diff, issue evidence, and regression tests. Canonical-step checks guard both mapping paths; change ranges are interpreted in each step's coordinate space; same-text replacement invalidates old spans; language/text checks and removing invalidated decorations before mapping prevent stale code-to-paragraph highlighting. Unknown custom steps rebuild fully. The ordinary paragraph proof and host-neutral boundaries remain intact.

Independent validation on Node 22.22.2 / npm 10.9.7:

  • Both targeted test files passed: 21 tests.
  • An additional reviewer oracle probe passed 4,573 comparisons covering exhaustive range boundaries in nested/empty code fixtures, deletion/text/same-slice/block replacements, inverse transactions, same-transaction forward/inverse sequences, and a custom replacement step reporting an empty map.
  • All five CI jobs passed for this exact head: javascript, Chromium UI, Extension Host, and CLI packaging on Ubuntu and Windows. Reviewed the implementer's successful verify:all evidence as well.

Performance assessment: real mixed-corpus code edits reduce highlight calls from 250 to 1; paragraph edits/marks from 250 to 0. Non-ordinary transactions still scan the document. The optional ordinary-input release budget is not met: matched local baseline/candidate input p95 was 61.8/58.1 ms against 50 ms, with dispatch median 11.3/10.85 ms. This comparison does not show an ordinary-input regression, but does not establish a general latency guarantee or waive the existing budget.

Proceeding with the user-authorized squash merge, constrained to the reviewed head commit.

@SWBaek
SWBaek merged commit de6176f into main Sep 7, 2026
5 checks passed
@SWBaek
SWBaek deleted the perf/247-incremental-lowlight branch September 7, 2026 08:35
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.

[Feature]: 코드·서식 편집에서 영향받은 코드 블록만 다시 강조 표시

1 participant