symbol-usage.nvim icon indicating copy to clipboard operation
symbol-usage.nvim copied to clipboard

Slow performance on go-to-definition and go-to-reference

Open mostafaqanbaryan opened this issue 1 year ago • 2 comments

Hi, and thank you for this great plugin! Recently I had some problem with the performance of neovim. Today, I narrowed the problem down to symbol-usage. So I work in a company on a monorepo projects that has some big php files (about 6000 lines... don't ask why) Without symbol-usage, gd and gr work instantly. But when I enable symbol-usage using require('symbol-usage').toggle(), it really slows down. Like it takes 10 seconds to go to the definition. Currently I can't provide any screenshot, but if it's needed, I could do that.

How to produce:

  1. Go to a little php file.
  2. Reference a function from a big file (about 6000 lines).
  3. gd on it. It should be instant.
  4. gr on the method in the big file. It takes about 2-3 seconds.
  5. Do that again and it takes more (about 10 seconds).

Let me know I should provide anymore details.

mostafaqanbaryan avatar Aug 18 '24 16:08 mostafaqanbaryan

Hi!

To reproduce the problem, I need the following data from you

  1. minimal configuration without third-party plugins on which the problem is reproduced;
  2. A sample of a php project with described files (I don't use php, so I have nothing to test on);
  3. Which version of nvim and which language server you are using.

Also, I think in your case lsp-server is just slow, because for each symbol there is a query for reference. Try to add a condition to ignore large files in the plugin settings (option disable.cond).

Wansmer avatar Aug 19 '24 04:08 Wansmer

  1. I don't have a minimal config. You only need to install intelephense in mason. -- If this is a must, let me know please.
  2. https://gist.github.com/mostafaqanbaryan/abaee02cb77dc1ea59dbc4a2999c57cd
  3. NVIM v0.10.1 and intelephense 1.12.4

I think disabling the plugin for large files could work, but I can't work without it now, so... 😁

mostafaqanbaryan avatar Aug 19 '24 06:08 mostafaqanbaryan

I took a minimal config from another issue and was able to reproduce the described problem.

I also tested working with large files for other lsps (lus_ls, tsserver) - no such delay.

I will see how to improve performance for intelephense

Wansmer avatar Aug 20 '24 05:08 Wansmer

That's great. Thank you!

mostafaqanbaryan avatar Aug 20 '24 05:08 mostafaqanbaryan

Done #64

Wansmer avatar Aug 26 '24 11:08 Wansmer

Thank you! I'll test it tomorrow!

mostafaqanbaryan avatar Aug 26 '24 19:08 mostafaqanbaryan