Repository navigation
Conversation
Walking an edge along a long line rescanned back to its start at every step, so a long run of quote marks with a colour span took seconds to render. Same output, linear. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq6RetJnzXvEeXAvSsgvs1
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Author
|
The failing Generated by Claude Code |
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.
What
tcMarkSpanswalks a colour span's edge past syntax characters one step at a time, and each step rescanned back to the start of the line (lastIndexOf('\n'), the>quote-prefix and open-tag regexes, and)looking back for](). On a long line that is quadratic. A message made of>repeated, carrying one colour span, took 1.7 s at 40 KB and 7.1 s at 80 KB in Node, and it does this on every render.This builds per-position look-back tables once per call: last newline, last
](, last<and>, and where each run of quote marks starts. Each check is then O(1).lastIndexOf('\n', -1)still checks index 0, as before.Verification
<,>,](,)and newlines), with spans: 0 differences.>with a span: 7.1 s → 87 ms.npm run check:globals: clean.The GPUI port carries the same fix (
crates/vector-gpui/src/textcolor.rsongpui), checked against this JS with the same harness.Generated by Claude Code