LuaLS / lua-language-server

A language server that offers Lua language support - programmed in Lua
https://luals.github.io
MIT License
3.13k stars 290 forks source link

Diagnostics run `await.delay()` too often #2665

Open emmericp opened 1 month ago

emmericp commented 1 month ago

https://github.com/LuaLS/lua-language-server/pull/2664 got a 25% speed increase by disabling await.delay() for the non-interactive use case.

Many diagnostics call await.delay() for every single ast node they check, so running all diagnostics on a file will probably reschedule the thread more than once per node which is a significant overhead.

I guess fully removing it for the interactive use case isn't a great solution, but maybe there is some kind of middleground like only rescheduling only every n calls?

emmericp commented 1 month ago

Note: this is likely not directly related to https://github.com/LuaLS/lua-language-server/issues/2660, because that bug is about a slowdown that is way worse than only 25%