Persist state between profiled startup runs - #331860
Merged
Dmitriy Vasyura (dmitrivMS) merged 1 commit intoAug 20, 2026
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Persists representative warm-start state after desktop startup profiling without affecting measured timings.
Changes:
- Flushes workbench storage with shutdown semantics.
- Bounds persistence to five seconds and exits nonzero on failure.
- Preserves the profiler’s hard-exit behavior.
Show a summary per file
| File | Description |
|---|---|
src/vs/workbench/contrib/performance/electron-browser/startupTimings.ts |
Flushes profiled startup state before exiting. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Balanced
Dmitriy Vasyura (dmitrivMS)
marked this pull request as ready for review
August 20, 2026 20:25
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
August 20, 2026 20:25
Anthony Kim (anthonykim1)
approved these changes
Aug 20, 2026
Dmitriy Vasyura (dmitrivMS)
deleted the
dev/dmitriv/persist-profiled-startup-state
branch
August 20, 2026 21:05
Copilot started reviewing on behalf of
Dmitriy Vasyura (dmitrivMS)
August 20, 2026 21:59
View session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Desktop startup profiling writes its timing output and then calls
nativeHostService.exit(0). This intentionally avoids waiting for a complete application shutdown, but it also bypasses the normal shutdown storage flush.That makes repeated profiler runs less representative of a normal clean warm start. State normally persisted during shutdown is absent from the next run.
One confirmed example is the editor font measurement cache:
editorFontInfoentry after the runeditorFontInfois persisted after the warmupWithout the persisted entry, the next profiler run repeats synchronous DOM character-width measurement instead of restoring the cached font metrics. CPU traces confirmed that
DomCharWidthReader._readFromDomElementsis present in every current profiler run and absent after a persisted warmup.This is a performance-infrastructure accuracy issue. Normal VS Code shutdown already flushes the same state; this does not change normal user startup or shutdown behavior.
Change
After startup timers, duration markers, heap statistics, and output files have been completed:
WillSaveStateReason.SHUTDOWN.finally.The flush happens after all measured values are collected and written, so storage persistence is not included in the reported startup interval. It only extends the unmeasured process lifetime after results are available.
Measurement accuracy
This makes repeated profiler runs use the same persisted state that follows a normal clean VS Code shutdown.
Verified behavior:
editorFontInfoafter warmupThe nonzero exit is important: if persistence fails, the performance harness must reject the run rather than silently accepting a following run with unexpectedly cold state.
The flush also emits the standard shutdown save event, so other components participating in normal shutdown persistence can provide representative warm state to subsequent measurements.
Scope / lack of product behavior changes
Validation
npm run typecheck-clientnpm run transpile-clienteditorFontInfois persisted only with the fix.