robocorp / robotframework-lsp

Robocorp extensions for VS Code: Robocorp Code and RFW LSP
https://robocorp.com/docs/developer-tools/visual-studio-code
Apache License 2.0
202 stars 91 forks source link

Performance Issue #696

Open Sam-Eldin opened 2 years ago

Sam-Eldin commented 2 years ago

Describe the bug This occurs sometimes and not always. When I start to write keywords it takes some time to show me the suggestions which is understandable (I have a lot of keywords) but sometimes it get stuck, the whole IDE (PyCharm) freezes and I have to kill it from task-manager,

To Reproduce Steps to reproduce the behavior: I do not know, as I said, it doesn't always happen, there is no static behavior for it to occur again, when I open PyCharm again on the same file, and write the same keyword it'll work flawlessly.

** Maybe, this is happening when moving between branches in GIT, cannot tell you exactly because I never managed to reproduce it.

Expected behavior To not freeze the IDE and maybe to be a bit faster

Screenshots None, as they would be useless

Versions:

Logs None

fabioz commented 2 years ago

Hi @Sam-Eldin when that happens, do you by any chance have non-empty .log items in C:\Users\<username>\.robotframework-ls? If you have any, can you share those?

Also, is this some project you can share? (I haven't seen reports related slowness in quite a while, so, this may be due to its size or structure -- it'd be nice if I could take a look to be able to check what may be making it slow in your particular example).

fabioz commented 2 years ago

Actually, there's one known issue related to working with really big files (i.e.: https://github.com/robocorp/robotframework-lsp/issues/682). Do you think that could be your case too?

Sam-Eldin commented 2 years ago

hey, sorry for the delay I took sometime off work. unlike that issue I do not have big files but I do have many many files, sorry cannot share the code as its work related. But I did have a previous plugin, I deleted it long ago, also I'm using a different IDE version now. Logs I have non, sorry. ... the structure of the file is usually something like: Import Global functions // APIs, generators, global variables.... then the test suit and test cases, never more than 200 lines. but when I write the function name for example it takes a lot of time to show me the suggestions (The names of the function have +- the same prefix AAPI Order Folder -- AAPI Order Job..., could this be a problem?)

fabioz commented 2 years ago

@Sam-Eldin I was thinking about this... usually what I do when I have a case which gets stuck is attach a profiler to know what may be happening.

The tool I tend to for profiling Python code is: https://www.pyvmmonitor.com/. Would you be up to firing it up to collect profile data for your use case?

It can do an attach to process on the fly (so, you shouldn't need to have to do any special setup) and it should be able to start collecting profile info right after the attach.

It'd be nice if you can get a profile showing when it gets slow in general first and another one when it gets stuck in some particular case.

Note that multiple processes are created in the backend, so, you may need to attach to all of them (if you're not able to get it setup, we can do a brief zoom call so that I can explain it to you).

Note that this would handle the backend case, but it's also possible that there's some issue in the client side (Intellij), in the case where it gets really stuck (in which case it'd be interesting to get a thread dump from java too -- this can be done using the VisualVM: https://visualvm.github.io/download.html, attaching to the java running Intellij and getting a thread dump).

fabioz commented 2 years ago

p.s.: see https://github.com/robocorp/robotframework-lsp/issues/350#issuecomment-842506969 for some brief instructions on pyvmmonitor.