Skip to content

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

Open
h-east wants to merge 1 commit into
masterfrom
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
masterfrom
syntax-state-search-hint

Conversation

@h-east

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

Copy link
Copy Markdown
Owner
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
@h-east h-east force-pushed the syntax-state-search-hint branch from c9620f5 to 92dd6d3 Compare June 1, 2026 06:28
@h-east h-east force-pushed the syntax-idlist-cache branch from 9991544 to a40637c Compare June 2, 2026 02:25
@h-east h-east force-pushed the syntax-state-search-hint branch from 92dd6d3 to 950791c Compare June 2, 2026 02:26
@h-east h-east force-pushed the syntax-idlist-cache branch from a40637c to 2339b40 Compare June 2, 2026 19:48
@h-east h-east force-pushed the syntax-state-search-hint branch from 950791c to a966217 Compare June 2, 2026 19:50
@h-east h-east force-pushed the syntax-idlist-cache branch from 2339b40 to d8e12d5 Compare June 3, 2026 10:44
@h-east h-east force-pushed the syntax-state-search-hint branch from a966217 to 32b8b75 Compare June 3, 2026 10:45
@h-east h-east force-pushed the syntax-idlist-cache branch from d8e12d5 to b0b17c2 Compare June 7, 2026 14:55
@h-east h-east force-pushed the syntax-state-search-hint branch from 32b8b75 to 598b6e8 Compare June 7, 2026 14:59

@danainacore danainacore left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Haha

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-idlist-cache branch from b0b17c2 to e01b8fc Compare June 12, 2026 07:07
@h-east h-east force-pushed the syntax-state-search-hint branch from eb14f24 to 13a4672 Compare June 12, 2026 07:08
@h-east h-east changed the base branch from syntax-idlist-cache to master June 12, 2026 07:22
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.

2 participants