aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/provider/python.lua
diff options
context:
space:
mode:
authorVolodymyr Chernetskyi <volodymyr_chernetskyi@goodyear.com>2026-09-15 14:36:32 +0200
committerGitHub <noreply@github.com>2026-09-15 20:36:32 +0800
commit3f21132a65a9c1f9ae5307bb59a5c730240c4a34 (patch)
tree25ebc70b5793e8419bbf7f79a0194ae52175fd5c /runtime/lua/vim/provider/python.lua
parentc1666d1f154dd39ba416c863e51f0ef8889039f5 (diff)
downloadrneovim-3f21132a65a9c1f9ae5307bb59a5c730240c4a34.tar.gz
rneovim-3f21132a65a9c1f9ae5307bb59a5c730240c4a34.tar.bz2
rneovim-3f21132a65a9c1f9ae5307bb59a5c730240c4a34.zip
vim-patch:9.2.1107: getregionpos() is slow when only the region bounds are needed (#41925)
Problem: getregionpos() returns a pair of positions for every line, so obtaining just the outer endpoints of a region costs O(lines); for a 100000 line region that is about 1.4 million list allocations for a result of which the caller keeps two positions. Solution: Add a "bounds" item to {opts} that returns a single pair with the start on the first line and the end on the last line (Volodymyr Chernetskyi). The lines in between do not influence the outer endpoints, so with "bounds" they are not visited at all. The two positions then come from different lines and describe a diagonal of the region rather than its shape; for a blockwise region they are the start of the first line and the end of the last line, not the corners of the block. This is exactly what indexing the full result gives, so the awkward corners are kept as they are, including an empty first line yielding a "col" of 0 for the start while the end keeps its own column. On a 100000 line buffer this takes getregionpos() from about 45 ms to about 0.003 ms per call. closes: vim/vim#21209 https://github.com/vim/vim/commit/2173c3e4eceedc76c4fd7d56cdbfbbd35e9be853
Diffstat (limited to 'runtime/lua/vim/provider/python.lua')
0 files changed, 0 insertions, 0 deletions