Skip to content
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

Plugin hangs when Cmd files in executed from $HOME CWD #75

Closed
ratheesh opened this issue Oct 21, 2019 · 14 comments
Closed

Plugin hangs when Cmd files in executed from $HOME CWD #75

ratheesh opened this issue Oct 21, 2019 · 14 comments
Labels
help wanted Extra attention is needed performance vim

Comments

@ratheesh
Copy link
Contributor

If Clap files or similar command related to searching is executed with $HOME or a folder with large number of files/folders as current working directory, command hangs without a way out. Only way to recover is killing vim(I tested using neovim).
Is there a way out in this situation?

@liuchengxu
Copy link
Owner

liuchengxu commented Oct 21, 2019

Yes, I'm seeing this too. Unfortunately it's hard to resolve, although everything in vim-clap can be async now, for it is essentially a problem that how to keep reponsive when dealing with the CPU-intensive jobs. There are more than 1 milion files in the home directory on my machine. Try using fd or rg to search some file under the home directory from the terminal, you'll see the CPU usage is almost 100%, especially when the query string is short.

Use fzf.vim instead if you do often search under the home directory. I don't have a solution for now. Let me know if anyone knows how to keep it responsive when the CPU usage is utterly high.

@liuchengxu liuchengxu added help wanted Extra attention is needed performance labels Oct 21, 2019
@liuchengxu liuchengxu pinned this issue Oct 21, 2019
@liuchengxu
Copy link
Owner

LeaderF also work well in this sitution. Take a look if you really care about this issue.

What's more, do you have any sugguestions for vim-clap here? @Yggdroot

@ratheesh
Copy link
Contributor Author

@liuchengxu Thank you.

@ratheesh
Copy link
Contributor Author

With PR #70 , I don't see this issue.

@liuchengxu
Copy link
Owner

I indeed did some optimizations in #70, but I don't believe that could eliminate this issue. And I guess you are using neovim? With #70 neovim are truely more responsive than before, but for vim, the response will still unsatisfactory.

@Yggdroot
Copy link

I don't know what kind of algorithm clap uses, LeaderF doesn't wait until all the files indexing is finished, it uses one thread to index the files and uses another thread to do fuzzy matching and display the results.

@liuchengxu
Copy link
Owner

The strategy of clap is trivial. What clap actually does is to start a fd/rg job in the background to do the searching task, whenever the output callback gets some results, display or cache them. And I think it because the out_cb of vim is linewise that you will feel less responsive in this situation compared to neovim.

I guess the thread model used in LeaderF is not appliable to clap as it's in pure vimscript :(. I have no idea vimscript could do the same thing.

@Yggdroot
Copy link

Bad luck, vimscript does not have the concept of thread.
I'm not familiar with the Job APIs, I am afraid I can't give any help now.

@ratheesh
Copy link
Contributor Author

I indeed did some optimizations in #70, but I don't believe that could eliminate this issue. And I guess you are using neovim? With #70 neovim are truely more responsive than before, but for vim, the response will still unsatisfactory.

Yes, I am using neovim. But one can come out by pressing ESC key. I will take it for now.

@Yggdroot
Copy link

@liuchengxu Maybe you need to redraw when necessary. There is a situation that the results are ready but the UI is not refreshed.

@liuchengxu
Copy link
Owner

Can you elaborate? @Yggdroot I don't see it on my side.

@Yggdroot
Copy link

I did not mean Clap has such a situation, just a hint.
Because when I use the popup window of vim, I found that it need to call redraw sometimes to refresh the UI.

@liuchengxu
Copy link
Owner

Thanks for the heads up :(. Will do when neccessary.

@liuchengxu
Copy link
Owner

Closing this in favor of #140.

@liuchengxu liuchengxu unpinned this issue Nov 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed performance vim
Projects
None yet
Development

No branches or pull requests

3 participants