ins_compl_add() checks for an existing match by scanning the whole
match list, so collecting N candidates is O(N²). Large dictionaries
and keyword-rich buffers hang; 'autocomplete' pays this per keystroke.
Keep match strings in a hashtab and look candidates up there. The old
scan is an exact-match, case-sensitive test, so the lookup is
equivalent; the scan is kept for "nearest" scoring, which must visit
matches to update scores. complete_info() output is byte-identical to
an unpatched build across ten dedup scenarios.
Benchmarks (min of 3): CTRL-X CTRL-K on /usr/share/dict/words
0.23s -> 0.020s; CTRL-N over 20k unique words 0.83s -> 0.016s.
Adds Test_ins_complete_dedup(); it also passes unpatched, pinning the
existing behavior.
https://github.com/vim/vim/pull/20926
(2 files)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()