mirror of
https://github.com/neovim/neovim.git
synced 2026-10-25 07:07:55 -05:00
Problem: The floating-point `.d` number match and the two ellipsis
matches are slow: each begins with a look-behind, which cannot
be reduced to a fixed first character, so the automatic regexp
engine selects the slower NFA backend for them.
Solution: Force the backtracking engine with \%#=1 on those three
patterns; it evaluates the look-behind far more efficiently.
Highlighting is unchanged.
Measured with :syntime over a 40000 line corpus: the three affected
rules drop from ~0.13s to ~0.008s (about -93%), which cuts the total
syntax parse cost by ~10% (1.85s to 1.65s).
closes: vim/vim#21194
https://github.com/vim/vim/commit/e9c5e56081d1923caab5efce1f6fca4e235cf350
Co-authored-by: Julien Voisin <julien.voisin@dustri.org>