DEV Community

Discussion on: Rust and Neovim - A Thorough Guide and Walkthrough

Collapse
 
phnaharris profile image
phnaharris

Thank you for your content. I'm using Rust with nvim recently for my development workflow. I see that when I open rust file that import a large codebase (solana program library) in background, rust-analyzer open a new instance for each buffer (background), and cause very high cpu (100% at all 12 threads) and ram (20gb for rust-analyzer). I dont see that problem with vscode (vscode just open an rust-analyzer instance). Did you face with that problem, and can you help me to fix it (or it's nvim-lsp feature???)???

I use vimplug, nvim-lsp (with lsp-saga and nvim-cmp) and rust-tool.

Thank you.

Collapse
 
rsdlt profile image
Rodrigo Santiago

Hi and thanks for reading. With rust-analyzer I have not experienced an issue with CPU load, but I have noticed that it indeed opens a new instance per buffer consuming ~257M of RAM:

rust-analyzer memory

And something similar happens with other LSPs servers. For example, this is the load for Texlab with two buffers open:

texlab memory

However, I rarely have more than 5 or 6 buffers open simultaneously, so it has no impact on my workflow.

I would suggest that you open a report in the Neovim Core LSP repo

Collapse
 
phnaharris profile image
phnaharris

Thank you for your reply. I've just found that my project rely on a large code base from another crate, so that is the reason why that the rust-analyzer take a lot of resource. And ya the lsp start a new instance per buffer, but vscode open just one (according my experience), so that why I have an bad experience with that specific project in nvim.

Collapse
 
phnaharris profile image
phnaharris

Hello friend. After a month facing with that problem, I've found that why my computer get burned when I open a large imported project. Because I use a plugin called lspsaga.nvim for better UI, and that plugin open a bunch of buffers (for better previewing experience), cause the rust-analyzer start a new process attached to each buffer. That is the reason I think till now. Just updating it's not a bug from nvim lsp config.