Repository navigation
perf(virtual-core): rebuild the layout once per resize batch - #1393
Conversation
🦋 Changeset detectedLatest commit: cc64aef The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
View your CI Pipeline Execution ↗ for commit cc64aef
💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗ ☁️ Nx Cloud last updated this comment at |
🎯 Changes
Summary
Dragging the scrollbar on a large list with measured rows drops frames (#1072). In one ResizeObserver batch, after an entry adjusts scroll,
resizeItemrebuilds the whole layout for every later entry. With 100k rows that is about 13 full rebuilds per frame. This PR computes each later entry's start from the size changes since the last build, so the layout is rebuilt once.Benchmarks
Chromium (Playwright), 100k rows with real text of different heights, default
measureElement. Each frame setsscrollTopto a random spot, like dragging the scrollbar. 120 frames, same result in 2 runs:What changed
resizeItemkeeps the size changes made since the last layout build.getMeasurements().lanes > 1, a customshouldAdjustScrollPositionOnItemSizeChange, or measurement options or the size cache changed another way.Correctness
getItemKeyabout 1k times instead of 10.5k.✅ Checklist
pnpm run test:pr.🚀 Release Impact