Closed kevinkirkup closed 1 month ago
Given then information I cannot replicate. I have opened 100 files and don't have any significant slowdown. This could be related to plugins that you have or even things like language servers doing a lot of work or something.
One note is running :AstroUpdate
or :Lazy update
without a restart will definitely not improve performance at all. It's very much recommended to restart entirely after update.
I'm seeing the same issue on my install. Attempting to edit:
Results in a UI which is incredibly slow to navigate. Everything seems to grind to a halt. Scrolling/Navigating up and down a screen of code is particularity slow and laggy. Watching btop
I can see a significant (significant being contextual to the hardware being used) spike in CPU usage.
My nvim version
info is:
NVIM v0.10.1-dev-101+g18a9ae169
Build type: RelWithDebInfo
LuaJIT 2.1.1713484068
Run "nvim -V1 -v" for more info
What's the best way to turn this issue report into something actionable? Is there any sort of telemetry/profiling/observability tooling that can be run which will help pin-point the problem?
A couple more items of note:
:AstroUpdate
. Lastly - I'm wondering if the hardware being used may contribute to how observable this issue is? I have my nvim setup in a VM (been this way for a while) and it's setup to use 2 virtual CPU's (@ 2.3Ghz). Previously this hasn't been an issue.
I'm a huge fan of the work that the AstroNvim team (and Neovim team) does - so if there is something I can do to help investigate please let me know.
I'm honestly not sure. All of my performance testing involves throttling my CPU and testing on extremely low power and decreased cores just so I can emulate low resource and/or older hardware. Not sure the best way of debugging this outside of maybe bisecting the AstroNvim repo to see if you can pin point a commit where the performance gets worse
Thanks @mehalter
Let me try killing some plugins and see what happens. Also - I was wrong above. Editing lua
files actually seems OK. IF I wait for the Lua Language Server to idle back down. When it loads it's busy for a bit before settling back down. If I wait it out (again watching btop
) then the editing experience is OK.
Nice. Yeah it is possible that it's language server related and if that's the case it's sorta out of scope from us to be able to fix in any way
Totally get that.
For Go
I think something else is in the mix. As I wait for gopls
to go idle before attempting to use things and the editing experience is "not great".
Just a heads up:
Noticed these messages may be related:
No LSP client found that supports symbols in buffer 31
@kevinkirkup nearly 100% isn't related. That is an Aerial bug: https://github.com/stevearc/aerial.nvim/issues/393
But shouldn't be causing any performance issues.
@mehalter Is aerial
being pulled in by Astro?
It's not a plugin that I've included in my config. I do see it in my lock file though. 🤔
yeah it's a default plugin: https://docs.astronvim.com/reference/default_plugins/
@mehalter, @kevinkirkup
tl;dr
In my astronvim
install I have found the following two plugins appear to be having a significant impact on CPU:
return {
{ "rebelot/heirline.nvim", enabled = false },
{ "lukas-reineke/indent-blankline.nvim", enabled = false },
}
Read below for the details:
Before I discuss my results - let me discuss my methodology as I don't have concrete proof other than observed impact on CPU.
My methodology:
btop
running in a terminal window - leave this window open, but make sure it's visible.gopls
and it's peers to run and go idle before continuing. In other words: Wait for the CPU to idle.Astronvim
using the up/down arrow keys (or the j/k keys). nvim
consumes)Where I started today:
My baseline config: CPU usage while scrolling would hover around 20% to 30% across two cores running at 2.3ghz. The UI would visibly stutter (repeatedly)
Running nvim
with all plugins disabled: CPU usage while scrolling would sit around 1% to 3% (tested with: nvim --clean /some/file/name.go
). The UI seemed smooth while scrolling.
How I "debugged":
I would go through and shut off options in Astrovim and eventually I disabled plugins entirely until I got my CPU usage down to (close) to the numbers I observed when nvim
was running with 0 plugins.
What I found was that the following two plugins seemed to be having an outsized impact on my CPU usage:
Tested by adding a file named disabled.lua
into my lua/plugins
folder with the following content:
return {
{ "rebelot/heirline.nvim", enabled = false },
{ "lukas-reineke/indent-blankline.nvim", enabled = false },
}
With these two plugins disabled my CPU usage would sit around 4% to 7% while actively scrolling up/down.
I understand heirline
is a pretty critical part of the default Astronvim
experience. For me - I am likely to need to find an alternate status line configuration. indent-blankline
is very helpful to me - but I can probably live without it.
My configuration can be found here (the config I was using to test with) should that be helpful:
https://github.com/jsco2t/dotfiles/tree/av-perf-investigation/.config/nvim
@jsco2t really appreciate the deep dive! This is amazing information! I'll be curious if you find that a different statusline plugin does any better, I did some benchmarking against lualine and feline and our heirline implementation is highly optimized with caching and stuff to decrease how much work it does. I see on my end that the CPU usage is less than when using those statusline plugins. indent-blankline definitely will be pretty intensive
@mehalter
As it happens I played a lot with this last night. I ended up using heirline
but customized it slightly to remove some of the components that were updated on cursor movement. The performance is now completely acceptable (as long as I also leave indent-blankline.nvim
disabled).
Here is a copy of the configuration I used for heirline
(it's based on what's in the Astronvim Docs - amazing work whoever put those together): https://github.com/jsco2t/dotfiles/blob/main/.config/nvim/lua/plugins/statusline.lua
@jsco2t This solved it for me. Thanks! Initially I was blaming the poor performance on neo-tree plugin as with open file tree I would get extremely bad performance (e.g. easily 5sec switching between buffers) and practically stopped using the tree. With the updated heirline config the UI is snappy as it should be. ❤️
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.
Checklist
:Lazy update
and are on the latest version of AstroNvimrepro.lua
provided belowOperating system/version
macOS 14.5
Terminal/GUI
kitty
AstroNvim Health
============================================================================== astronvim: require("astronvim.health").check()
AstroNvim ~
git
is installed: Used for core functionality such as updater and plugin managementopen
is installed: Used forgx
mapping for opening files with system opener (Optional)rg
is installed: Used for Telescopelive_grep
picker,<Leader>fw
and<Leader>fW
by default (Optional)lazygit
is installed: Used for mappings to pull up git TUI (Optional)node
is installed: Used for mappings to pull up node REPL (Optional)gdu-go
is installed: Used for mappings to pull up disk usage analyzer (Optional)btm
is installed: Used for mappings to pull up system monitor (Optional)python
is installed: Used for mappings to pull up python REPL (Optional)Describe the bug
After launch nVIM, the use is fine but slow gets slower and slower. Updating Astro doesn't fix the issue and perhaps, makes it worse. The only solution to to restart the entire nVim instance.
Steps to Reproduce
:AstroUpdate
Expected behavior
nVim should be snappy
Screenshots
No response
Additional Context
No response
Repro