-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Unbearably slow in my code base: https://github.com/scverse/scanpy #5474
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
Comments
@flying-sheep can you upload a log as described here? I cannot reproduce any slowdown with that configuration in that same project. A log may at least point to what part is taking so long. Does it only reproduce for certain files? I've tried a bunch and they all save instantly. |
Those are the log entries generated when typing a single space (not at the end of a line) and saving the file The log entries however only appear after the majority of waiting is over:
Disabling Pylance makes the wait go away. The black formatter runs in <1sec and is not responsible for the wait time.
|
To help other stuck in the same situation, switching back to |
Not sure how 2023.6.40 solves the problem, we haven't really changed much of anything in the last week. However, I am able to cause analysis to take a long time if I try to save This setting is causing VS code to wait for all code action providers (not sure why VS code does this though):
So, the combination of that setting and the fact that test_neighbors takes a very long time to analyze is the reason for the slow down. I'm guessing the work on this issue here is why format on save forces code actions to be gathered: |
Here's the directions for my repro:
I get output like so:
|
And I cannot repro it on 2023.6.40 either. |
The difference between the two versions seems to be something marking the file as continually dirty:
Not sure which file is being marked dirty, but these messages all appear after saving a single file. The same doesn't occur in 2023.6.40. |
This change is the cause of the slowdown: Not sure why yet. That change seems correct to me. |
With that change, analyzing the test_neighbors.py takes 5000ms. Without it takes 500ms. |
We don't have access to this private repo. So can't say much, and hope my comment won't look like as me being an asshole. What I know is this isn't the first time of similar problem happening (few months ago it did) and users like me lost hours/days of work due to this, saying to our managers/PM VSCode is not working I can't work this week is very frustrating experience. If the problem is due to the same code being change again, but me worth finding a way to avoid this in the future as this is extremely painful. |
I want to express that I value all the hard work going into this project. Python was in desperate need for a good language server that integrates with typing. @Jacques-Peeters I assume there is performance testing, and I assume pathological cases like this will be tested in the future. We’re using a relatively new project, things like this are to be expected. |
You're right, this is also the value of the project having constant product updates. |
After some more investigation the commit that caused the problem was not the root cause. It simply put the underlying file system back to the way it should have been. This bug is reproducible with Pyright, but it doesn't manifest the same way. Instead, it just shows the analysis taking a long time.
|
@erictraut, the repro steps are in this comment here: Same repro applies to show it taking a long time in Pyright too. |
This was addressed in pyright 1.1.317, which added more aggressive caching for protocol type matching. It is included in this week's "insiders release" of pylance and will be in next week's production release. It's related to this issue. You can see the measured speedup in various code bases that use numpy. |
Saving files takes multiple seconds. VS Code waits and eventually shows a popup “Getting code actions from ''Python"”.
When setting
"python.languageServer": "None",
saving works as expected.Why will VS Code wait for Pylance to save things? I have only
source.fixAll.ruff
activated, so the Python extension shouldn’t be consulted when saving a file at all.Originally posted by @flying-sheep in microsoft/pylance-release#4263 (comment)
The text was updated successfully, but these errors were encountered: