VS Code performance checklist
vs-code performance extensions
Some things to look at when dealing with poor performance of Visual Studio Code.
November 1, 2021
Recently I was helping a customer investigate "poor performance" when working with Visual Studio Code. The specifics aren't important, but I put together a list of things (tools, techniques) to look at when dealing with VS Code performance, which might come handy.
It's clear that "poor performance" can mean anything from slow startup, sluggish user interface to underperforming debugged applications. This list tries to cover all and will be updated over time.
See if it’s really VS Code causing the issue
- eliminate external factors – connecting to a cloud database etc.
- check network latency, when connecting to a remote virtual system
- if possible, run the application in Visual Studio 2019/2022 and see if the perf issue happens there as well
What compute resources are available on the machine?
- for instance: VS Code doesn’t run well on single-core machines (https://github.com/Microsoft/vscode/issues/17097)
- look at Task Manager
- is there a CPU/RAM strain on the machine?
- are there other things running on the machine?
Within VS Code, what’s consuming CPU and RAM?
- F1 –> "Developer: Open Process Explorer"
- see what processes are running and how much they consume
- look at "extensionHost" in particular, because high load there would suggest that extensions are the culprit
Check Developer Tools
- F1 -> "Developer: Toggle Developer Tools"
- opens a standard Chromium dev tools where you can see JavaScript errors, network etc.
- this can sometimes help identify that there’s an issue
If VS Code takes too long to start, look at Startup Performance
- F1 -> "Developer: Startup performance"
- this view provides detailed information about what’s happening on start and if there are extensions which take too much time
- this might also be a good opportunity to evaluate if you really need all of the installed extensions, because the more you have, the slower VS Code gets
Profile running extensions
- F1 -> "Developer: Show running extensions"
- if you suspect that specific extension is causing an issue, find it in this view and see the activation time
- with the extension selected, you can start profiling by clicking the "Start Extension Host Profile"
- work with the extension for a bit and then save the profile to a
.cpuprofile
file
- use Chromium developer tools to load the profile and see what’s happening in the extension
- F1 -> "Developer: Toogle Developer Tools"
- then go to "More tools" -> "JavaScript profiler" and load the
.cpuprofile
profile
Disable all extensions and see if the issue persists
- either use the menu in the Extensions tab
- or start Code with:
code --disable-extensions
Enable/disable extensions one by one to identify which one is causing the issue
- either start with no extensions active and activate them one by one, or go the opposite direction – start with all extensions active and deactivate them one by one
- validate if you experience the unwanted behavior
Look at the extension’s repository to see if there are any known issues
- once you identify that it’s a specific extension causing the perf issue, you can start looking into it
- extensions like Azure Functions have their own GitHub repository (look for the "Repository" link on the extension's page)
- look at issues to see if someone else has reported your problem too (https://github.com/microsoft/vscode-azurefunctions/issues)
- or create new issue
Disable/enable extensions per workspace
- it is possible to selectively disable extensions in particular workspace (for instance a JavaScript-only application doesn’t need .NET tools)
Disable GPU
- especially in virtualized environments some issues can be resolved by disabling GPU rendering
- F1 -> "Preferences: Configure Runtime Arguments" ->
"disable-hardware-acceleration": true
- or start VS Code from the command line:
code --disable-gpu
Various optimizations
- besides extensions, the overall performance of Code can be improved by:
- disabling MiniMap
- disabling CodeLens
- disabling Format on save
- this obviously comes with the price of reduced functionality of the IDE
Report an issue from VS Code
- F1 -> "Help: Report issue..."
Check the Performance Issues wiki
- more detailed instructions and tips can be found on the VS Code wiki: https://github.com/Microsoft/vscode/wiki/Performance-Issues
Feedback
Found something inaccurate or plain wrong? Was this content helpful to you? Let me know!
📧 codez@deedx.cz