diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2026-09-15 08:10:25 +0800 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2026-09-15 08:19:50 +0800 |
| commit | 666f8252aaf7ae499157050dd030d4e34c4aada6 (patch) | |
| tree | 9578b719397372aada1f31c2169154dfc9f797ee /runtime/lua/vim/provider/python.lua | |
| parent | 2190e51c180a9c25030e55faca6c493fb7c9540c (diff) | |
| download | rneovim-666f8252aaf7ae499157050dd030d4e34c4aada6.tar.gz rneovim-666f8252aaf7ae499157050dd030d4e34c4aada6.tar.bz2 rneovim-666f8252aaf7ae499157050dd030d4e34c4aada6.zip | |
vim-patch:9.2.1103: regexp compilation decodes ASCII bytes as multi-byte
Problem: When compiling a regexp the lexer calls mb_ptr2char() and
utf_ptr2len() for every character, including plain ASCII, even
though a byte below 0x80 is always a single character equal to
itself. Patterns are mostly ASCII, so this is wasted work on the
hot compile path.
Solution: In peekchr() and skipchr() take a fast path for bytes below 0x80,
skipping the multi-byte decode calls (Julien Voisin).
peekchr() already holds regparse[0] in "curchr", so a byte below 0x80 needs no
mb_ptr2char() call; the backslashed case is handled the same way. skipchr()
likewise advances by one byte directly instead of calling utf_ptr2len(). Both
regexp engines share this lexer, so both compile faster.
NFA pattern compilation is about 5% cheaper (skipchr() -29%, peekchr() -13%);
loading a set of syntax files is about 1.4% faster end to end.
closes: vim/vim#21301
https://github.com/vim/vim/commit/e5da1f1f037d2549c883db709ecde2928d0f047e
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