Optimize performance of completion pipeline#302
Open
mattn wants to merge 3 commits into
Open
Conversation
- Replace exists('l:startcol') with a boolean flag in s:on_change()
- Avoid full asyncomplete#context() in textchangedp change detection; use lightweight line()/col()/getline() instead
- Build context dict directly from local vars instead of intermediate dict lookups
- Skip s:strip_pair_characters() call when base doesn't start with a pair character
- Bulk-append items when base is empty instead of per-item add
- Use add() instead of += [val] for startcols list building
- Fix redundant getcurpos() call in timer.vim s:maybe_notify_on_change()
- Early return in asyncomplete#log() when log file is empty
- Simplify s:should_skip() to single return expression - Remove unused l:curitems variable in s:recompute_pum() - Remove unused l:last_char variable in asyncomplete#_force_refresh() - Use add() instead of += [val] for list appending consistently - Use repeat() for bulk startcols fill instead of while loop - Use l:trigger[-1:] instead of l:trigger[len(l:trigger) -1]
- Remove unused l:curitems variable in s:recompute_pum() - Remove unused l:last_char variable in asyncomplete#_force_refresh() - Use add() instead of += [val] for list appending consistently - Use repeat() for bulk startcols fill instead of while loop - Use l:trigger[-1:] instead of l:trigger[len(l:trigger) -1]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
asyncomplete#context() is called many times.
asyncomplete#context()in textchangedp change detection; use lightweightline()/col()/getline()directly since only lnum/col/typed are needed for comparisonexists('l:startcol')with a boolean flag (l:has_startcol) ins:on_change()to avoid reflection overheads:strip_pair_characters()when base doesn't start with a pair character+=when base is empty instead of per-itemadd()add(l:startcols, l:startcol)instead ofl:startcols += [l:startcol]to avoid temporary list allocationgetcurpos()call in timer.vims:maybe_notify_on_change(); reuse already-storeds:previous_positionasyncomplete#log()when log file is empty to reduce nesting