[vim/vim] runtime(xslt,xsd): speed up highlighting by removing backtracking from patterns (PR #20436)

9 views
Skip to first unread message

Dmytro Meleshko

unread,
Jun 6, 2026, 3:07:04 PM (3 days ago) Jun 6
to vim/vim, Subscribed

Scrolling in these filetypes is too slow, so I investigated which syntax patterns were causing the slowdown with :syntime. Turns out it was the matching of XSL/XSD-specific tag names was costing way more time than it has to. I fixed this with by using the lc=... parameter for the regexes, which makes the syntax engine step a number of characters back before matching the pattern, which in this case is practically equivalent to a lookbehind in front of the pattern. I also made them check the character before the name of the XML namespace which they weren't doing before, so that stuff like <notxsl:element>... does not get matched.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/20436

Commit Summary

  • 2c0ae3c runtime(xslt,xsd): speed up highlighting by removing backtracking from patterns

File Changes

(2 files)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20436@github.com>

dkearns

unread,
Jun 7, 2026, 4:21:36 AM (3 days ago) Jun 7
to vim/vim, Subscribed
dkearns left a comment (vim/vim#20436)

Did you use lc=5 rather than \@5<= for performance or because you were unaware that lookbehinds could specify a byte limit? I'm mostly curious because lc is described as obsolete in the docs and while I haven't tested it in years it used to be about 2x faster than byte-limited lookbehinds. That was with regexpengine=1 but I imagine the difference is considerably greater with regexpengine=2.

It might be an idea to clarify the documentation at :help :syn-lc


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20436/c4641930151@github.com>

Christian Brabandt

unread,
3:55 PM (7 hours ago) 3:55 PM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#20436)

Thanks, I include it


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20436/c4663487039@github.com>

Dmytro Meleshko

unread,
3:56 PM (7 hours ago) 3:56 PM
to vim/vim, Subscribed
dmitmel left a comment (vim/vim#20436)

@chrisbra Please wait before merging this patch


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20436/c4663492923@github.com>

Dmytro Meleshko

unread,
3:58 PM (7 hours ago) 3:58 PM
to vim/vim, Subscribed
dmitmel left a comment (vim/vim#20436)

I have some other changes that I want to make, but didn't have time to. Please confirm that you've seen this comment.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20436/c4663505619@github.com>

Christian Brabandt

unread,
3:59 PM (7 hours ago) 3:59 PM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#20436)

okay, holding off then


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20436/c4663513772@github.com>

Reply all
Reply to author
Forward
0 new messages