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

bug: noice command prompt slow on network storage #694

Closed
3 tasks done
jeffrysleddens opened this issue Jan 14, 2024 · 5 comments · Fixed by #703
Closed
3 tasks done

bug: noice command prompt slow on network storage #694

jeffrysleddens opened this issue Jan 14, 2024 · 5 comments · Fixed by #703
Labels
bug Something isn't working

Comments

@jeffrysleddens
Copy link

jeffrysleddens commented Jan 14, 2024

Did you check docs and existing issues?

  • I have read all the noice.nvim docs
  • I have searched the existing issues of noice.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

0.9.5

Operating system/version

Debian GNU/Linux 12.4

Describe the bug

I noticed that the Noice command prompt is really slow in my environment. Every keypress in the command prompt feels very slugish. I first tried to exclude all the other plugins and then it was a little bit faster. Then I tried one by one to add plugins back, but there was not real one plugin that I could tie the slowness to. I also completely reinstalled nvim 0.9.5 with LazyVim without any other customizations, but that also resulted in a very slow command prompt.

I then used strace to see what nvim was doing when I was typing a command in the Noice command prompt. And then I saw that with every keypress it goes through all my .local/share/nvim subdirectories looking for files called noice.lua, noice.vim and subdirectories called "syntax/noice". This is about 90 statx calls and 56 access calls per key press in the command prompt which you don't really notice on local storage, but on a network filesystem like in my case NFS it is really noticable.

Strace output of a single key press in the Noice command prompt:
noice_commandprompt_keypress_strace_output.txt

This is quite a lot of filesystem calls especially when it happens on every single key press.

Steps To Reproduce

  1. Have homedirectory on network storage like NFS
  2. Install latest Nvim
  3. Install LazyVim
  4. Open command prompt (':')
  5. Start typing

Expected Behavior

A fast responsive command prompt without lag.

@jeffrysleddens jeffrysleddens added the bug Something isn't working label Jan 14, 2024
@jeffrysleddens
Copy link
Author

jeffrysleddens commented Jan 17, 2024

I thought it might be treesitter related. Treesitter trying to find noice syntax for highlighting of the command line. But I tried removing the treesitter plugin and it still searches for the syntax files on every key press.

@jeffrysleddens
Copy link
Author

jeffrysleddens commented Jan 17, 2024

If I run nvim with the following commands the Noice command line is fast:

:filetype plugin indent off
:syntax off

So it's the standard nvim filetype detection and syntax features that trigger on every key press in the Noice windows. I wonder if there is a way to disable that behaviour.

@jeffrysleddens
Copy link
Author

jeffrysleddens commented Jan 17, 2024

So for every key press, M.tag from lua/noice/util/init.lua gets called, and if the filetype of the current buffer is empty it sets it to "noice" which causes neovim to search for ftplugin, syntax, indent, etc definitions for the non-existant "noice" language. This is pretty standard practice which is done by lots of plugins, but in this case it is really noticable because it gets called on every single key press and when you're nvim configuration is on network storage it causes quite a delay/lag.

@folke folke closed this as completed in bf67d70 Jan 22, 2024
@folke
Copy link
Owner

folke commented Jan 22, 2024

That commit should fix it. Do let me know if that wouldn't be the case. Thanks

@jeffrysleddens
Copy link
Author

Super! Thanks! I just tested it with a clean nvim 0.9.5 and Lazyvim installation and it works perfectly now. Noice input is lag-free now even on network storage. Fix confirmed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants