-
Notifications
You must be signed in to change notification settings - Fork 73
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
Neovim performance issues with CursorHold autocmd #100
Comments
FYI, this seems to be a |
Haven't looked into this yet, but could you try increasing or reducing the delay times for deferred highlighting?. It looks like some kind of race condition where if a time event at exactly the same time as cursorhold, you get problems. I know the timer implementation is completely different between nvim and vim. |
@andymass thanks for the quick response. It is an issue with Here are weird observations that I made using the testcase of this issue:
2- is especially weird since relaxing It looks like I think |
@andymass , here is a temporary way to fix this perf bug: https://github.com/antoinemadec/FixCursorHold.nvim |
@antoinemadec interesting, thanks for pointing out this workaround! I wonder if it makes sense to decouple the delay on your plugin from updatetime (which defaults to 4000, and this is how often a swap file is written to disk). My worry is that you will get CursorHold fired twice; once by your plugin and once by neovim. |
@andymass , I used Regarding the option to decouple This decoupling should ideally come from Vim and Neovim themselves.
That being said, I am not against the idea of an option in my plugin that:
I am swamped with a bunch of things right now, but I might add it later. Cheers! |
@andymass , I just added a separate update time for cursorhold 😃 : antoinemadec/FixCursorHold.nvim@1097c90 |
Thanks again for your contribution to users of this plugin @antoinemadec. The neovim team recently posted a message regarding the buggy nature of CursorHold: https://neovim.discourse.group/t/psa-dont-rely-on-cursorhold-yet/1813. I want to mention that match-up does not use CursorHold in any way, the performance issues were visible when using match-up but not ultimately caused by this plugin. Unfortunately, this still needs to be fixed in neovim and FixCursorHold provides a temporary workaround. Closing this issue- it remains pinned to help people looking for a solution. |
Explain the issue
neovim
CursorHold
autocmd is 2x to 5x slower thanvim
when usingvim-matchup
Minimal vimrc file
Expected Behavior
diff_time should be 100ms since
set updatetime=100
.Actual Behavior
For this example:
vim
diff_time is constantly around 100ms.neovim
diff_time varies a lot from 150ms to more than 200ms on my PCOn my full vimrc:
neovim
diff_time goes from 150ms to 500ms ❗vim-matchup
, bothvim
andneovim
have the same performance (~100ms)My config:
Possible Explanations
It might be because:
vim
andneovim
don't trigger the same code invim-matchup
neovim
issue/different behavior regardingCursorHold
Regarding 1., I tried to comment out the neovim specific code from
vim-matchup
and still observed the same slowdown forneovim
.Regarding 2., it might be related to
timers
, maybeneovim
wait for timer to return before executingCursorHold
?What do you think, do you know where the slowdown is coming from?
Also, thank a lot for creating this plugin, it is absolutely amazing ❤️
Thanks,
Antoine
The text was updated successfully, but these errors were encountered: