-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Extension causes high cpu load #24737
Comments
@intellegenstom Was this during a diff with python code in it? |
I had the vscode source control panel open, but was not actively looking at a diff. I was working on a large python codebase |
What do you have for the |
Pylance. I'm also getting the freezes with the source control panel closed now I check this |
@karthiknadig the cpu profile here is for the python extension, this wouldn't be actionable by Pylance. @intellegenstom is there a cpu profile for the pylance extension? |
Additionally, pylance has some commands you can run if you think it's the cause of a slowdown. Generally, a freeze in the UI isn't Pylance though as we run most of our code in a separate process. |
This might be an issue with the diff-editor. In the python extension we really don't specifically look at diffs. The uploaded CPU profile and the one in the image you have shared seem very different. The CPU profile in the screen shot is for the workbench process, and the extension profile is from extension host process. |
I'm not an expert in debugging vscode behaviour, @rchiodo could you let me know how to generate a profile for a specific extension - I just used general performance monitoring from the developer tools. The freezes seen at the same time as the cpu profile file and at the same time as the performance profile screenshot were qualitatively similar, but I don't know if that means they are caused by the same issue |
You can profile an extension in VS code through the 'Show Running Extensions' command. Then you right click on the extension you think is the problem and click 'Start Extension Host Profile' What you did was profile the whole application (using Developer tools), which is probably where the problem is given that a big chunk of time was in the diff editor. But if you profile the Pylance extension we can see if there's any time spent there. You stop the extension profile with a right click again: Then that should show how much time was spent in each extension. You right click again to save the profile and upload it: |
I'm not quite sure how to read this, but it looks like the Python extension is the one being highlighted? |
Yeah at least the profile shows 1.5 seconds in the Python extension. Transferring back to Python. |
@eleanorjboyd Looks like the time here is being spent on creating test items for the test explorer. @intellegenstom We have auto re-discover tests on by default. It looks like in this case it is causing a lot of load attempting to create items. You can turn it off as a workaround. |
@intellegenstom does it work to lower load if you turn off the auto-discovery on save? Could you give me a sense of the test suite as well? Approx how many tests does it have? does it use pytest or unittest? Does it have plugins or use subtests/parameterized tests? Does it have large amount of nesting / folders or is it relatively flat? These can give me a sense of what about this project is making it so costly for CPU and where I can look for a fix |
Thanks - I turned off |
Performance
python
2024.22.1
Windows_NT x64 10.0.22631
1.96.4
ms-python.python-unresponsive.cpuprofile.txt
Find more details here: https://github.com/microsoft/vscode/wiki/Explain-extension-causes-high-cpu-load
The text was updated successfully, but these errors were encountered: