Avoid forced layout when measuring the Chat view title - #331846
Merged
Dmitriy Vasyura (dmitrivMS) merged 5 commits intoAug 20, 2026
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Replaces synchronous Chat title height reads with an asynchronously updated cache to reduce forced layout during startup and relayout.
Changes:
- Adds ResizeObserver-based title height tracking.
- Relayouts Chat when the cached height changes.
- Adds focused height-change tests.
Show a summary per file
| File | Description |
|---|---|
chatViewTitleControl.ts |
Adds observer-backed height caching. |
chatViewPane.ts |
Uses the updated title control constructor. |
chatViewTitleControl.test.ts |
Tests cached height and deduplication. |
Review details
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Balanced
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Dmitriy Vasyura (dmitrivMS)
marked this pull request as ready for review
August 20, 2026 20:35
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
August 20, 2026 20:35
Copilot started reviewing on behalf of
Dmitriy Vasyura (dmitrivMS)
August 20, 2026 21:25
View session
Raymond Zhao (rzhao271)
approved these changes
Aug 20, 2026
Dmitriy Vasyura (dmitrivMS)
deleted the
dev/dmitriv/observe-chat-title-height
branch
August 20, 2026 21:53
Copilot started reviewing on behalf of
Dmitriy Vasyura (dmitrivMS)
August 20, 2026 23:18
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.
Background
This change comes from a Windows startup performance investigation across published Insiders builds and subsequent packaged CPU profiling.
A warmed renderer profile showed repeated synchronous calls to
ChatViewTitleControl.getHeight()consuming about 20-30 ms during startup.getHeight()readtitleContainer.offsetHeight, which could force Blink style/layout after the title or its toolbars changed.Observed startup caller paths included:
and:
The title height is dynamic, but the browser already exposes that state asynchronously and before paint through
ResizeObserver.Change
onDidChangeHeightevent only when the observed height changes.getHeight()instead of readingoffsetHeight.ChatViewPanerelayout path, which applies the final observed size before paint.ResizeObserver.There is no intended visual or accessibility change.
Startup improvement
Focused warmed CPU traces:
ChatViewTitleControl.getHeightself-timeEnd-to-end validation used fully bundled current-source Windows desktop applications with identical Electron, resources, extensions, minification, and NLS processing. The applications differed only by this change.
Two independent campaigns ran 30 interleaved measured pairs each, alternating A/B and B/A order after three warmups.
The conservative end-to-end startup gain is 11.5 ms on this Windows host.
Repeated phase improvements across both campaigns:
The phase measurements overlap and should not be summed.
Improvements to other scenarios
The removed forced layout was not startup-specific. The same code runs when:
These paths now consume the cached browser-reported height instead of synchronously flushing style/layout.
ResizeObservercontinues to trigger the existing relayout event whenever the real border-box height changes.The measured 13 ms improvements in both primary viewlet and auxiliary-bar restoration demonstrate that the gain applies across multiple Chat view locations.
Compatibility and behavior
onDidChangeHeightlistener.The focused test verifies:
getHeight().Validation
Rejected alternatives
getBoundingClientRect()reads with cached observer width removed that leaf but did not improve packaged startup over 30 interleaved pairs.