Files
neovim/runtime
zeertzjq 7f7115f752 vim-patch:560dfad: runtime(yaml): syntax highlighting of numbers is slow
Problem:  YAML syntax highlighting is slow; the yamlInteger and yamlFloat
          rules alone account for over half of the parsing time.
Solution: The number, null and timestamp scalar patterns begin with a
          lookbehind, which stops the regexp engine from using a
          first-character search, so the automatic engine selects the
          much slower NFA engine.  Force the backtracking engine with
          \%#=1 on these patterns for a large speedup with identical
          matches (Jordan).

On a 40000-line YAML file the total :syntime drops by about 30%: the
yamlFloat rule goes from 0.61s to 0.17s and yamlInteger from 0.42s to 0.31s.
The engine override is applied only to the lookbehind-anchored number rules;
forcing it on the structural plain-scalar and mapping-key patterns regresses
them badly, so those are left on the automatic engine.

closes: vim/vim#21182

560dfadac8

Co-authored-by: Julien Voisin <julien.voisin@dustri.org>
2026-08-31 10:45:59 +08:00
..