Skip to content

Avoid synchronous activity bar size measurement - #335537

Merged
Dmitriy Vasyura (dmitrivMS) merged 2 commits into
mainfrom
agents/vscode-insiders-startup-profiling
Sep 12, 2026
Merged

Avoid synchronous activity bar size measurement#335537
Dmitriy Vasyura (dmitrivMS) merged 2 commits into
mainfrom
agents/vscode-insiders-startup-profiling

Conversation

@dmitrivMS

@dmitrivMS Dmitriy Vasyura (dmitrivMS) commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Remove the vertical activity bar's synchronous global-action-container clientHeight read during startup layout.

  • Compute global action height from the rendered action count and the existing action-height/gap inputs that also drive CSS, including gaps only between items.
  • Recompute available view-switcher space when Accounts is hidden or shown; keep repeated visibility updates idempotent.
  • Preserve classic, compact, and Modern UI sizing, horizontal sidebar bars, and keyboard behavior. No CSS, labels, or keybindings change.

This follows the remaining activity-bar layout cost observed after the titlebar fix in #334751.

Performance validation

Compared baseline and candidate on the same complete Code OSS development build at 333552ca38d5e15c8b734157159fcfcae9553c87, using separate warmed profiles and alternating order. Baseline modules were compiled from HEAD using the repository's normal compiler; only the three affected generated modules were exchanged.

Five measured untraced launches and three measured traced launches per variant, after warmups:

Startup metric (median) Baseline Candidate
Activity-bar layout sampled self time 26.094 ms 0 ms
Total forced style/layout before didStartWorkbench 26.850 ms 14.936 ms
Untraced startup 4,147 ms 4,170 ms
Traced startup 6,352 ms 6,352 ms

Forced layout decreases by approximately 44.4% (11.9 ms) rather than merely disappearing from the original function's profile. A remaining flush occurs during focus handling.

Compute global activity height from rendered actions and the existing CSS sizing inputs instead of reading clientHeight during layout. Recalculate overflow when Accounts visibility changes and cover compact, Modern UI, and horizontal layouts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 10, 2026 19:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The implementation matches its stated performance goal and includes focused regression coverage.

Review tier: Balanced
Findings: None

What changed in this PR

Replaces startup DOM measurement with deterministic activity-bar sizing while preserving existing layouts and interactions.

Changes:

  • Calculates global action height from action count, height, and gap.
  • Relayouts when Accounts visibility changes.
  • Adds coverage across activity-bar modes and orientations.
File Description
globalCompositeBar.ts Adds calculated height and change events.
activitybarPart.ts Uses calculated global-action sizing.
sidebarPart.ts Adapts to the revised constructor contract.
globalCompositeBar.test.ts Tests sizing and visibility idempotence.
activitybarPart.test.ts Tests layout modes without DOM measurement.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Benjamin Christopher Simmonds (@benibenj)

Matched files:

  • src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
  • src/vs/workbench/browser/parts/globalCompositeBar.ts
  • src/vs/workbench/browser/parts/sidebar/sidebarPart.ts

@dmitrivMS Dmitriy Vasyura (dmitrivMS) changed the title workbench: avoid synchronous activity bar size measurement Avoid synchronous activity bar size measurement Sep 12, 2026
@dmitrivMS Dmitriy Vasyura (dmitrivMS) added this to the 1.139.0 milestone Sep 12, 2026
@dmitrivMS
Dmitriy Vasyura (dmitrivMS) merged commit 3addbda into main Sep 12, 2026
33 checks passed
@dmitrivMS
Dmitriy Vasyura (dmitrivMS) deleted the agents/vscode-insiders-startup-profiling branch September 12, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants