-
-
Notifications
You must be signed in to change notification settings - Fork 336
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
Performance drawback #496
Comments
Did you use generics in your project? |
No, also the project isn't currently fully EmmyLua documented, most of files are still "plain lua". |
Tested now with 1.20.3, but it's still very slow, seems that the issue exists both with 1.20.2 and 1.20.3 |
I noticed this too, and maybe this helps: When it hangs on diagnosis, there were a lot of notifications, that VS Code is currently running diagnosis on one file. Maybe the previous diagnosis doesnt get stopped when a new one starts? |
Can confirm what @mcb5637 said: https://i.imgur.com/rn5LfU4.mp4 |
It seems that the previous diagnosis task has fallen into an endless loop, so that it cannot handle the signal to stop the diagnosis. |
Same issue here, also while this happens, the language server uses a lot of memory - usually 3-5GB but sometimes even more than 10GB. |
looks like diagnosis takes much longer since 1.20.2 than 1.20.1 |
might be caused by duplicated meta files, I have a copy of meta/3rd/cocos4.0 folder in my project, it doesn't happen when I remove it |
I don't have any meta folder in my project (it's a game using the Löve framework). My guess at the moment is, that it might be caused by big files as one of my Lua files I do a lot of work in, is ~15k lines. Maybe it's just a kind of race condition in such situations ... but that's also just a guess. |
I just reported a similar experience here. EDIT I just figured out that when using lua-dev if I do: local lua_settings = require('lua-dev').setup().settings.Lua
lua_settings.workspace.library = require('lua-dev.sumneko').library()
lua_settings.workspace.library['/usr/share/nvim/runtime'] = nil
vim.fn['coc#config']('Lua', lua_settings) Everything becomes snappy. The key was to remove |
FWIW I also observed the same behaviour and so disabled the |
this version works |
I'm debugging this issue right now and was able to bisect the performance degradation to this commit. I'll see if I can make a fix. |
Thank you for the test, and sorry for the late reply. |
@sumneko I'll double-check and will let you know in a bit. Thanks! |
@sumneko I found the issue and created a PR. Performance is back to how it used to be now :) |
@folke It's awesome! Many thanks! |
You're welcome and thank you for all the great work on the lua language server! |
Well, on my side it seems precisely the reverse has happened, even with my previous fix, things have become worse than before, it's consuming so much CPU that's affecting even while I'm typing this message o_O. |
@oblitum must be something else then on your end. I have another user of lua-dev that reported that new new server is very fast now. folke/neodev.nvim#14 (comment) Are you sure you are using the latest version 1.21.3? You also still should probably disable callsnippets, since that still causes a performance degradation. (haven't tested on the last release, since I have that disabled) I made a small change to |
Okay, it seems I've been actually affected by a change on the lua-dev.nvim plugin, not on the lua language server... Reverting it bring things back to normal. |
@oblitum are you sure about that? The new change to lua-dev removes some things from your package path and keeps |
Yes I'm sure, I upgraded everything before testing, then just reverted the commit from lua-dev.nvim to bring it to where it was before. It seems on my side I have not benefited the improvements on the server either, because I still need to use |
@oblitum no idea what's causing those issues on your end. For me everything runs instantly with the runtime enabled. |
Before folke/neodev.nvim@6bf74db I get this:
{
on_new_config = <function 1>,
settings = {
Lua = {
awakened = {
cat = true,
<metatable> = <1>{
__tostring = <function 2>
}
},
diagnostics = {
globals = { "vim" },
<metatable> = <table 1>
},
runtime = {
path = { "./?.lua", "/home/runner/work/neovim/neovim/.deps/usr/share/luajit-2.1.0-beta3/?.lua", "/usr/local/share/lua/5.1/?.lua", "/usr/local/share/lua/5.1/?/init.lua", "/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/?.lua", "/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/?/init.lua", "/home/francisco/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua", "/home/francisco/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua", "/home/francisco/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua", "/home/francisco/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua", "lua/?.lua", "lua/?/init.lua" },
version = "LuaJIT",
<metatable> = <table 1>
},
telemetry = {
enable = false,
<metatable> = <table 1>
},
workspace = {
library = {},
maxPreload = 2000,
preloadFileSize = 150,
<metatable> = <table 1>
},
<metatable> = <table 1>
},
<metatable> = <table 1>
}
}
{
["/home/francisco/.local/share/nvim/site/pack/packer/opt/zen-mode.nvim"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/cheatsheet.nvim"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/hop.nvim"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/lsp-colors.nvim"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/lua-dev.nvim"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/lua-dev.nvim/types"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/lualine.nvim"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/nvim-base16"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/nvim-tree.lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/nvim-treesitter"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/nvim-treesitter-textsubjects"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/nvim-web-devicons"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/packer.nvim"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/plenary.nvim"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/popup.nvim"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/telescope-coc.nvim"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/telescope.nvim"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/tmux-complete.vim"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/todo-comments.nvim"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/vim-matchup"] = true,
["/usr/share/nvim/runtime"] = true
} After folke/neodev.nvim@6bf74db I get this:
{
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
<metatable> = <1>{
__tostring = <function 1>
}
},
runtime = {
path = { "lua/?.lua", "lua/?/init.lua" },
version = "LuaJIT",
<metatable> = <table 1>
},
telemetry = {
enable = false,
<metatable> = <table 1>
},
workspace = {
library = {
["/home/francisco/.local/share/nvim/site/pack/packer/opt/zen-mode.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/cheatsheet.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/hop.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/lsp-colors.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/lua-dev.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/lua-dev.nvim/types"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/lualine.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/nvim-base16/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/nvim-tree.lua/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/nvim-treesitter-textsubjects/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/nvim-treesitter/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/nvim-web-devicons/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/packer.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/plenary.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/popup.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/telescope-coc.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/telescope.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/tmux-complete.vim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/todo-comments.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/vim-matchup/lua"] = true,
["/usr/share/nvim/runtime/lua"] = true,
<metatable> = <table 1>
},
maxPreload = 2000,
preloadFileSize = 150,
<metatable> = <table 1>
},
<metatable> = <table 1>
},
<metatable> = <table 1>
}
}
{
["/home/francisco/.local/share/nvim/site/pack/packer/opt/zen-mode.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/cheatsheet.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/hop.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/lsp-colors.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/lua-dev.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/lua-dev.nvim/types"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/lualine.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/nvim-base16/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/nvim-tree.lua/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/nvim-treesitter-textsubjects/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/nvim-treesitter/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/nvim-web-devicons/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/packer.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/plenary.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/popup.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/telescope-coc.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/telescope.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/tmux-complete.vim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/todo-comments.nvim/lua"] = true,
["/home/francisco/.local/share/nvim/site/pack/packer/start/vim-matchup/lua"] = true,
["/usr/share/nvim/runtime/lua"] = true
} So for my usage, I had to change this: local lua_settings = require('lua-dev').setup().settings.Lua
lua_settings.workspace.library = require('lua-dev.sumneko').library()
lua_settings.workspace.library['/usr/share/nvim/runtime'] = nil
vim.fn['coc#config']('Lua', lua_settings) to this: local lua_settings = require('lua-dev').setup().settings.Lua
lua_settings.workspace.library['/usr/share/nvim/runtime/lua'] = nil
vim.fn['coc#config']('Lua', lua_settings) Note that I don't need to call But the critical part for me is that now I have to exclude So, in the end, after this fix, speed is back to normal (still having to exclude something from library). |
@folke despite excluding |
Oh, sorry regarding poor report on my own version check. Even though I got an update prompt from coc-lua, for which I confirmed, coc-lua-binaries 1.21.3 is still on pre-release, so I may have not picked it yet (I'm still confused on that, will have to check it later). |
Okay, I updated the binaries manually (coc-lua binaries update process is broken) and indeed, I don't need to exclude runtime anymore! Sorry for the confusion. Also, it's indeed much faster than before, even when having runtime excluded. |
@oblitum glad you got it working! If you're not including the runtime, then you won't get proper docs for lua functions in the runtime. Things like what I include here So lsp, treesitter, vim shared, ... Those functions are not included in the emmy annotations directly. They are even excluded on purpose, since |
thx @folke! |
With the latest versions I noticed a performance issue, I usually work with a large Lua workspace (more than 850 source files), before that issue the workspace diagnostics used to load up in less then 3 minutes or so.
Now with the latest version it takes never less then 2-3 hours to complete the diagnostic analysis.
I'm pretty sure it's an issue introduced with latest versions because when i rolled back the VSCode extension to version 1.20.1 the issue disappeared and diagnostics started back to load in 2-3 minutes.
Environment:
The text was updated successfully, but these errors were encountered: