-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 taking very long to analyze files #9912
Comments
Thanks for reaching out. Since you started experiencing slow operations after recent updates, this could be related to the new language server mode setting we introduced recently. The default mode for this setting is Based on the logs you provided, it seems analyzing |
I have been experiencing this from updates I installed around October. I checked the settings, and the Diagnostic mode is set to |
can you share by the way, if you share ... if that doesn't work, we might need more detail log such as https://github.com/microsoft/pylance-release/wiki/Collecting-data-for-an-investigation.#collecting-type-evaluation-related-data-in-the-log or/and https://github.com/microsoft/pylance-release/wiki/Collecting-data-for-an-investigation.#collecting-cpuprofiles |
by the way, you mentioned |
Hi, sorry for the delay in getting back to you. This behavior is consistent across files and environments. Every additional statement (as simple as x = self.state_dim) I write takes a significant time (>15s) to analyze. Here is the Utils.py file:
The associated Config file:
The trace log is in the attached txt file. |
Paring this down to a simplified sample that exhibits poor analysis performance: from scipy.optimize import root
root(0, 0) If someone from the pylance team would like to transfer this to the pyright project, I can dig into it and see if there's a way to improve the performance. The scipy library is notoriously complex, and it has no inline type annotations. That means static type checkers like pyright need to infer type information from the library code. @apoorv-s, one thing you can do to eliminate the performance problem is to install type stubs for |
I looked into this further. I don't think there's much I can do here. As we already knew, The solution here is type annotations — either inlined type information shipped as part of the scipy library or a separate stub library. Thankfully, there is an ongoing effort to create a type stub library for scipy. As mentioned above, you can install this into your Python environment using the command I'm closing the issue since there's nothing actionable for pyright at this point. |
Environment data
Code Snippet
Repro Steps
Expected behavior
Till last month, the pylance has been working great, and I have had no issues. However, after some extension updates, the behavior is very slow and takes a long time to analyze even a few lines of code. The logs presented are for a small code with less than 100 lines of code, but this behavior is consistent across different conda environments (with different Python versions) and different files.
I tried reinstalling the vscode and the extension, but it did not resolve anything. Apologies if I am something trivial.
Actual behavior
XXX
Logs
The text was updated successfully, but these errors were encountered: