vscode: Storage migration is slow and happens on each new window
This one only took 2.8s, but sometimes I get 4s startup times:
- VSCode Version:
Code - Insiders 1.29.0-insider (5438af145cf480ce0162bda0799435684b293ec5, 2018-11-07T00:54:27.213Z)
- OS Version:
Darwin x64 17.7.0
- CPUs:
Intel® Core™ i7-4870HQ CPU @ 2.50GHz (8 x 2500)
- Memory(System):
16.00 GB(2.71GB free)
- Memory(Process):
315.69 MB working set(0.00MB peak, 166.49MB private, 149.20MB shared)
- Load(avg):
2, 2, 2
- VM:
0%
- Initial Startup:
yes
- Screen Reader:
no
- Empty Workspace:
yes
- Timings:
Component | Task | Duration(ms) | Info |
---|---|---|---|
[main] | start => app.isReady | 70 | true |
[main] | nls:start => nls:end | 1 | true |
[main] | app.isReady => window.loadUrl() | 318 | true |
[main->renderer] | window.loadUrl() => begin to require(workbench.main.js) | 344 | NewWindow |
[renderer] | require(workbench.main.js) | 1257 | cached data: NO |
[renderer] | require workspace storage | 4 | |
[renderer] | require & init workspace storage | 13 | |
[renderer] | register extensions & spawn extension host | 256 | |
[renderer] | restore viewlet | 0 | |
[renderer] | restore panel | 0 | |
[renderer] | restore editors | 268 | 1: workbench.editors.untitledEditorInput |
[renderer] | overall workbench load | 494 | |
[main->renderer] | workbench ready | 2541 | |
[renderer] | extensions registered | 2810 |
⚠️ Make sure to attach these files from your home-directory: ⚠️
-prof-cda2.extHost.cpuprofile.txt
-prof-cda2.main.cpuprofile.txt
-prof-cda2.renderer.cpuprofile.txt
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15 (15 by maintainers)
Commits related to this issue
- Improve performance of storage migration For #62733 **Problem** There is a loop that goes through all workspaces in storage (200+ in my case) and then through all keys in storage (5000 in my case). ... — committed to mjbvz/vscode by mjbvz 6 years ago
- For Microsoft#62733 **Problem** `parseStorage` computes a lot of data that we then immediately discard. **Fix** Try to only compute the data that we really will use by splitting `parseStorage` into ... — committed to microsoft/vscode by roblourens 6 years ago
- Optimize parseStorage (#62805) * For Microsoft#62733 **Problem** `parseStorage` computes a lot of data that we then immediately discard. **Fix** Try to only compute the data that we really wi... — committed to microsoft/vscode by mjbvz 6 years ago
@kieferrm and I looked into optimizing the
parseStorage
function further: https://github.com/Microsoft/vscode/tree/mjbvz/62733 Using @octref’s workspace data,parseStorage
goes from 4 seconds to 30ms, while total new window time goes from 6.5 seconds to 2.5 seconds .Main optimization points:
We were computing data for all storage but then immediately discarding almost all of it. This change splits
parseStorage
into 4 functions, one forempty
,noResource
,folder
, andmultiRoot
which allows us to compute only the data that we really needWe also ultimately only care about a specific workspace. In the
folder
case, this lets us avoid iterating over a large number of workspaces; all we need to iterate over are the workspaces that have the target folder as a prefix. In theempty
case, this lets us avoid creating extra maps that we then pick one from and discardOptimize some of the inner loops by removing now redundant checks
Still needs much more testing and review