patch 9.1.0352: Finding cmd modifiers and cmdline-specials is inefficient
Problem: Finding cmd modifiers and cmdline-specials is inefficient
Solution: Use binary search to find ex command modifiers and
cmdline-special characters and reduce the number of strlen()
(John Marriott)
closes: #14534
Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_cmdmods.vim b/src/testdir/test_cmdmods.vim
index 323a78e..66ff6a1 100644
--- a/src/testdir/test_cmdmods.vim
+++ b/src/testdir/test_cmdmods.vim
@@ -8,10 +8,10 @@
# :hide is both a command and a modifier
cmds->extend(['hide'])
- # Get the entries of cmdmods[] in ex_docmd.c
+ # Get the entries of cmdmod_info_tab[] in ex_docmd.c
edit ../ex_docmd.c
- var top = search('^} cmdmods[') + 1
- var bot = search('^};') - 1
+ var top = search('^static cmdmod_info_T cmdmod_info_tab[') + 1
+ var bot = search('^};.*\/\/ cmdmod_info_tab') - 1
lines = getline(top, bot)
var mods = lines->map((_, v) => substitute(v, '.*"\(\k*\)".*', '\1', ''))