aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/provider/python.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2026-09-17 09:17:14 +0800
committerGitHub <noreply@github.com>2026-09-17 01:17:14 +0000
commit40c434cc733ae22cbb506a0d63b7707057725202 (patch)
treec192c868dd9f353279024b26a57c91937b787a3c /runtime/lua/vim/provider/python.lua
parenta5cae0ad46c3c2893cafc2da8f9ebec6fde8b159 (diff)
downloadrneovim-40c434cc733ae22cbb506a0d63b7707057725202.tar.gz
rneovim-40c434cc733ae22cbb506a0d63b7707057725202.tar.bz2
rneovim-40c434cc733ae22cbb506a0d63b7707057725202.zip
vim-patch:9.2.1115: ml_updatechunk() rescans all chunks on every line update (#41949)
Problem: ml_updatechunk() only resumes its chunk scan for strictly consecutive line insertions; for line updates (e.g. ":substitute") and any other non-consecutive access it restarts the scan from the first chunk, which is slow on large buffers. Solution: Resume the forward scan from the cached chunk position whenever the wanted line is at or after it, falling back to a full scan only when moving backwards or into another buffer, and invalidate the cache only when the chunk table is changed. The static resume cache was previously used only for the strictly consecutive ML_CHNK_ADDLINE fast path. This commit generalizes it to cover all update types: every mutation leaves the cache pointing at the last touched chunk with a correct start line; the exits that move chunks around (split, collapse, reset) clear it, while the ones that leave the chunk table intact keep it, including the ML_CHNK_DELLINE exit that only decrements a line count. This turns repeated in-order updates (":s", line insertions and deletions such as ":g/pat/d") from O(chunks) per call into amortized O(1). With callgrind the substitute workload drops 1.8% in total instructions and ml_updatechunk() self cost drops 63%, granting a 10% speed boost on ":%s/\<int\>/int32_t/ge" in a buffer containing src/*.c closes: vim/vim#21309 https://github.com/vim/vim/commit/8692965f52a8e13084a6cb4d726ddc5f3b25c2c6 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