Skip to content

Avoid redundant breadcrumbs scroll updates while preserving revealLast UX#315384

Closed
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-perfsample-error
Closed

Avoid redundant breadcrumbs scroll updates while preserving revealLast UX#315384
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-perfsample-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 8, 2026

Description

The perf sample points to breadcrumb reveal work on editor-open/update paths.
After feedback, the fix was adjusted to preserve existing revealLast() UX (including behavior related to #168824) while still removing redundant hot-path work.

Changes made

  • Kept revealLast() using non-minimal reveal semantics:
    revealLast(): void {
    	this._reveal(this._items.length - 1, false);
    }
  • Optimized _reveal(...) to no-op when the target item is already aligned:
    • Early return when node.offsetLeft === scrollLeft
    • This avoids unnecessary setScrollPosition/scroll-toggle calls without changing reveal behavior.

Test updates

  • Replaced the focused test with one that validates no scroll update is performed when already aligned:
    • src/vs/base/test/browser/ui/breadcrumbs/breadcrumbsWidget.test.ts

Testing

  • npm run transpile-client
  • node test/unit/browser/index.js --run src/vs/base/test/browser/ui/breadcrumbs/breadcrumbsWidget.test.ts --browser chromium
  • npm run compile-check-ts-native

Copilot AI requested review from Copilot and removed request for Copilot May 8, 2026 22:17
Copilot AI linked an issue May 8, 2026 that may be closed by this pull request
Co-authored-by: dmitrivMS <9581278+dmitrivMS@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot May 8, 2026 22:26
Copilot AI changed the title [WIP] Fix PerfSampleError in breadcrumbsWidget Avoid forced scroll work in breadcrumbs revealLast hot path May 8, 2026
Copilot AI requested a review from dmitrivMS May 8, 2026 22:26
@dmitrivMS
Copy link
Copy Markdown
Contributor

@copilot Are you sure about the root cause?
Also, won't it make it even worse UX - see #168824 which you are also fixing...

Co-authored-by: dmitrivMS <9581278+dmitrivMS@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot May 8, 2026 23:00
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 8, 2026

@copilot Are you sure about the root cause?
Also, won't it make it even worse UX - see #168824 which you are also fixing...

You’re right to call that out. I adjusted this in 00075f3e.

I reverted revealLast() to non-minimal reveal (to avoid regressing #168824 behavior), and moved the perf optimization to _reveal: it now early-returns when node.offsetLeft === current scrollLeft, so we skip redundant scroll updates in the hot path without changing reveal semantics.

Copilot AI changed the title Avoid forced scroll work in breadcrumbs revealLast hot path Avoid redundant breadcrumbs scroll updates while preserving revealLast UX May 8, 2026
@dmitrivMS
Copy link
Copy Markdown
Contributor

Closing in favor of #315385, which folds in the same "skip redundant scroll update when aligned" optimization (generalized via getBreadcrumbScrollLeft so it covers minimal and non-minimal reveal paths) and additionally fixes the right-clipping reveal bug. The UX behavior from #168824 is preserved there as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants