Repository navigation
perf: remove repeated segmentation and quadratic composer navigation - #508
Open
raiseCatError wants to merge 1 commit into
Open
raiseCatError wants to merge 1 commit into
raiseCatError wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Long-command editing repeatedly constructs native grapheme segmenters and recalculates prompt width for each glyph. Visual-row movement additionally recalculates the full layout for every possible token boundary, producing a ~3-second arrow-key stall in the saved workload.
Reuse a lazily created segmenter, calculate prompt width once per row, and capture all caret positions in one pass through the shared wrapping implementation. Navigation retains token boundaries, paste-label mapping, earliest-token ties and clamping when clusters join across separately typed tokens. Temporary caret storage is linear; no input cache, dependency or worker is added.
Measured on M2 / 8 GiB / macOS 27 / Node 26.12, against unchanged dev:
Deterministic resource/scaling regressions were observed failing before implementation, then passing. Compatibility tests enumerate token positions across Unicode, split combining clusters, wrapped paste labels, narrow widths and styled/empty prefixes. Independent read-only review approved with no concrete blocker. Focused input tests and build pass; full canonical
npm run verifypassed with explicit xterm-256color/truecolor capabilities, NO_COLOR unset, two workers and private short T7 fixtures. No test assertions/deadlines weakened.Physical Ghostty/Zed QA: NOT RUN. Check long Unicode typing/deletion, wrapped/multiline vertical movement and selection, resized/styled/None prompts, multiple paste atoms and unwrap, Shift+Enter/Ctrl+J and Option+Backspace. Known intermittent macOS read issue is not claimed fixed. Keep the issue open pending hands-on validation.
Refs #507
Targets dev; do not merge automatically. Independent of output-rendering PR #506.
Exact-head CI:
10250f541f613153de10945aa11d3435cd92c2f4passed macOS/Ubuntu shards, Quality and Node 22 compatibility; aggregate CI green. Fedora/timing jobs skipped by workflow conditions. CI run. PR remains unmerged.Environment clarification: t7run supplies
NODE_COMPILE_CACHE=/Volumes/T7Tmp/ai-dev/caches/node-compile; the original before/after runs inherited it. No OS-cache purge or true cold-start claim. Separate cache-disabled/private-cache startup controls are being retained in the local evidence.