diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2026-09-14 08:46:47 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-14 00:46:47 +0000 |
| commit | 4033b7ce5378a9695b49bbd6931ed77278b018c4 (patch) | |
| tree | 9fdafdbfb9c3e0523f631e0c0a99886c740105c8 /runtime/lua/vim/provider/python.lua | |
| parent | 0f9db8c19362d158b5d345deeeaa9d610757a1c9 (diff) | |
| download | rneovim-4033b7ce5378a9695b49bbd6931ed77278b018c4.tar.gz rneovim-4033b7ce5378a9695b49bbd6931ed77278b018c4.tar.bz2 rneovim-4033b7ce5378a9695b49bbd6931ed77278b018c4.zip | |
vim-patch:9.2.1096: NFA regexp engine copies submatches slowly without captures (#41904)
Problem: copy_sub() accounts for a large share of NFA matching time because
it always calls memmove() to copy submatch positions for every
state added in addstate(), including the common case of a pattern
without capturing groups where only the whole match is tracked.
Solution: Copy a single submatch with a direct assignment when only
subexpression zero is in use, keeping memmove() for patterns with
more subexpressions (Julien Voisin).
addstate() calls copy_sub() for every state it adds; on a word-boundary
workload copy_sub() and the memmove() it calls together are about 18% of the
NFA matching instructions. A pattern without capturing groups only uses
subexpression zero, so copy_sub() copies a single struct; doing that with a
direct assignment drops the memmove() call from that path.
On a buffer of C code, uncaptured search and substitute patterns (identifiers,
function calls, numbers) get about 6-7%, with no measurable change for patterns
that capture. Not that much, but not that bad for such a small change.
closes: vim/vim#21297
https://github.com/vim/vim/commit/ca57ab28e7f31c90d6af8f134547b455ab88390d
Co-authored-by: Julien Voisin <julien.voisin@dustri.org>
Diffstat (limited to 'runtime/lua/vim/provider/python.lua')
0 files changed, 0 insertions, 0 deletions