aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/_watch.lua
diff options
context:
space:
mode:
authorJames <89495599+IAKOBVS@users.noreply.github.com>2024-03-12 13:35:53 +0700
committerGitHub <noreply@github.com>2024-03-12 14:35:53 +0800
commit3bd84317fb59ed4f7ec6585c516f9f8f4d823fd6 (patch)
treefd0ec502a5fd0b606a78c3c2b6b571b2f1e4b258 /runtime/lua/vim/_watch.lua
parenta74e869ffa503cc9c2d21836e24fec7a7ffca147 (diff)
downloadrneovim-3bd84317fb59ed4f7ec6585c516f9f8f4d823fd6.tar.gz
rneovim-3bd84317fb59ed4f7ec6585c516f9f8f4d823fd6.tar.bz2
rneovim-3bd84317fb59ed4f7ec6585c516f9f8f4d823fd6.zip
refactor: avoid quadratic behavior in backslash_halve() (#27827)
The original implementation has a worst-case of O(n^2). Every time rem_backslash() is true, it calculates the length of the rest of the string, and shift the rest of it to the left; backslash_halve_save() copies the original string before doing backslash_halve(). The new implementation is O(n). It will find the first character where rem_backslash() is true (it will do nothing if it's always false), and shift the characters in-place; backslash_halve_save() avoids copying the original string before doing backslash_halve().
Diffstat (limited to 'runtime/lua/vim/_watch.lua')
0 files changed, 0 insertions, 0 deletions