-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance profile #140
Comments
Issue-Label Bot is automatically applying the label Links: app homepage, dashboard and code for this bot. |
Glad to see you addressing the slowness. Perhaps take a look at |
I would say it's not appropriate to compare Edit: The author of fzf.vim junegunn clearly indicates the distincition between fzf.vim and the other similar plugins(vim-clap, Leaderf) in junegunn/fzf.vim#821 (comment) and vim/vim#4063 (comment):
I suggest you sticking to the combination of Edit: From the response of Bram in vim/vim#4063 (comment), I believe fzf.vim will support the vim popup eventually. In a word, if you are happy with fzf/fzf.vim, no need to play with the other alternatives then, it's great enough in most cases. Although I'll continue to optimize vim-clap, I don't think vim-clap has a chance to make people feel faster than fzf.vim. That would not work in theory. |
I'm not "sensitive" about speed. However I get a little annoyed when I can't even finish typing what I'm trying to search for, without an unreasonable amount of lag. I would at least expect it to debounce (wait for a small bit and give the user a chance to finish what they were typing before executing the search) rather than my cursor freezing on each character typed. (this is only the case for large amounts of files.)
While I won't argue that it shouldn't, if that's what you're going for. I'm not sure why. vim-clap does offload "the core logic and heavy tasks" in the case of |
This is an input delay for vim popup, see
This is not accurate.
This is not the point. Every finder needs these tool to produce the data.
Even I am not against using Python to improve the performance, I won't write another complete stand-alone binary otherwise it is reinventing the wheel |
I had tried that and it didn't seem to help. If this disabled for neovim, I'd assume, yes?
I'm not sure what the limitations of vimscript are, but sure. Which is exactly my point. Drawing an arbitrary line between what is and isn't okay to offload to an external program because "That's not the way of vim-clap." is a little... counter-productive.
But you are already "reinventing the wheel", no? Which is fine, but if your goal is optionally offloading for performance, why python? Why not allow offloading to |
This no input delay option for neovim as neovim keeps usable on my machine, even with 1 million files. Neovim also needs a similar input delay then.
Checkout the
Well, see the profile above ..., and the related discussion, such as #75.
By |
Most python interpreters use GIL. CPython uses it too and CPython is a most used Python interpreter. In short, GIL makes any python multithreading slower; and when I say "slower" I mean "it makes it single threaded and then slows it down more with all this thread-to-thread jumps". And async python code with GIL is even more slower than simple multithreaded. Though, if python code invokes some non-python library, this library's work won't be GILed. It could even run in standalone mode concurrently with the python script if invoked function won't return any data back to script, IIRC. So, yeah, python script should be either single-threaded and straightforward, or use non-python libs, to be fast. |
Not a Python expert and I have not written any Python multithreading code,but that's ok as long as the multi-threading won't slow Vim/NeoVim down, keeping it well responsive. Actually don't have to use However, as I have mentioned in section: Problem of async job of Vim and NeoVim, the redraw issue of async job still persists(it's basically unavoidable I think). But it's more like an user experience problem, not a performance issue, at least Vim/NeoVim can keep responsive anyway. So I still want the built-in sync filter to be faster, that's why I made fuzzymatch-rs as it does not have the redraw issue of async job. |
) * Add forerunnet job status sign and a delay timer for running maple Close #140 * Add doc * Check if has no matches when running maple * Update README.md
To fix the performance issue, ensure you have Rust installed on your system and run
:call clap#helper#build_all()
.Introduction
The one selling point of vim-clap is in pure vimscript, having a good platform compatibility and minimal pain to set it up, which is apparently an advantage. However, it becomes a disadvantage when you do a large scale searching/filtering job for the limit of vimscript language.
Profile of async job at scale
For instance, using
:Clap files
from my home directory and inputsr
, the result is[791970/823172]
. The following profile info is based on this commit dfffb5e.Profile of NeoVim:
Profile of Vim:
For the result set having about 1M items, neovim is still tolerable if you seldom run into that case, but for vim it's totally unusable. The core idea of vim-clap is to spawn a new job on your typing and then react on the callback, the callback of the job is called too many times on the surface.
Related providers
The performance issue only happens to these providers that can have a huge result set.
Searching
:Clap files
:Clap grep
Filtering
The current strategy is to use the built-in fzy written in python running synchronously when the items are no more than 10,000, switching the async way if it's more than the threshold and then it meets the same callback issue.
:Clap blines
:Clap lines
:Clap bcommits
:Clap commits
The challenge is to make
clap#filter#()
fast enough even whencandidates
is terrific.vim-clap/autoload/clap/filter.vim
Line 164 in 77631c1
Possible solution
python
multi thread. Since we have introduced the optional dependency for the built-in fzy support, we could also use the thread of python to improve the performance as suggested in Plugin hangs whenCmd files
in executed from $HOME CWD #75 (comment). As I'm not a python expert, I'm not sure if this will land in vim-clap eventually.lua
. Could be faster than vimscript at least in some filtering cases. I observe something promissing based on the this script measuring the vimscript with the other script languages:lua
is 4x faster thanpython
.luajit
is 100x faster thanpython
.Boost python filtering using Rust. I'm interested if https://github.com/rochacbruno/rust-python-example would help, which can replace
fuzzy_match()
:vim-clap/pythonx/clap/fzy.py
Line 9 in f4d280c
job
Use a timer for reading the output of vim job periodly, then the callback won't be called that many times. This branch is my try with timer. Using a timer helps a lot, but some messages are dropped unexpected, not sure if that's bug of Vim or my code. I did not investigate further as I have achived the same goal withmaple
as follows.The text was updated successfully, but these errors were encountered: