-
Notifications
You must be signed in to change notification settings - Fork 767
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
Pylance causes a huge CPU load #1388
Comments
It appears as though this is sympy, which has some known performance holes and will need some stubs. |
Yup, you're absolutely right! I uninstalled sympy and it works fine right now. Too bad I need sympy for my research... :( |
As a potential workaround, you could create a dummy type stub for sympy. This approach should eliminate the large CPU usage, but the tradeoff is that you won't get any completion suggestions for sympy. To do this, create a file in your project called from typing import Any
def __getattr__(name: str) -> Any: ... This will tell pylance that it shouldn't attempt to infer any type information from the sympy library. |
That should do the trick, at least for now. Thank you Eric! |
Dupe of #1388. |
@jakebailey you closed this as a duplicate of itself, did you mean to do that? Looking at the history, I think you meant to reference #946 instead? |
Yes, my mistake! Copy paste always gets me. |
Environment data
Expected behaviour
Pylance swiftly analyses the code and highlights the variables (just like week ago).
Actual behaviour
A process called 'Code Helper (Renderer)' uses >100% of CPU for approx 30-50 seconds. I tracked it by PID and unfortunately Pylance is the culprit, switching to a different language server is a remedy.
About the problem - every little change in the code triggers the whole process again. Variable name colouring update takes like a minute.
This issue might be related to #1368 reported by xmatthias. However there, he described the problem occurring in the big project. Here the file I am working on is a short, merely 50 line python script. Additionally I run on a different OS.
What surprises me the most, using older versions of Pylance didn't work at all. I somehow relate this bug to the recent macOS update, but I don't know if it is relevant.
I guess the description I've given might be a bit vague, as I am not familiar with bug reporting like this. However I will happily answer any questions you might have.
Logs
For convenience, I put the log in the attachment.
pylance_problem.log
The text was updated successfully, but these errors were encountered: