Skip to content

perf: syntax highlighting searches the saved state list from the start#30

Open
h-east wants to merge 1 commit into
syntax-idlist-cachefrom
syntax-state-search-hint
Open

perf: syntax highlighting searches the saved state list from the start#30
h-east wants to merge 1 commit into
syntax-idlist-cachefrom
syntax-state-search-hint

Conversation

@h-east
Copy link
Copy Markdown
Owner

@h-east h-east commented May 30, 2026

Problem:  Looking up the saved syntax state for a line scans the state
          list from the start every time, which is slow when highlighting
          a large file in increasing line order.
Solution: Remember the last found entry and start the search there when it
          is at or before the wanted line; the list is sorted, so the
          result cannot be earlier.  The highlighting is unchanged.

@h-east h-east changed the title syntax highlighting searches the saved state list from the start perf: syntax highlighting searches the saved state list from the start May 30, 2026
@h-east h-east force-pushed the syntax-idlist-cache branch from 256d550 to 719e174 Compare June 1, 2026 03:03
@h-east h-east force-pushed the syntax-state-search-hint branch from 2d9574e to c9620f5 Compare June 1, 2026 03:14
@h-east h-east force-pushed the syntax-idlist-cache branch from 719e174 to 9991544 Compare June 1, 2026 06:28
Problem:  Looking up the saved syntax state for a line scans the state
          list from the start every time, which is slow when highlighting
          a large file in increasing line order.
Solution: Remember the last found entry and start the search there when it
          is at or before the wanted line; the list is sorted, so the
          result cannot be earlier.  The highlighting is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@h-east h-east force-pushed the syntax-state-search-hint branch from c9620f5 to 92dd6d3 Compare June 1, 2026 06:28
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.

1 participant