perf: profile and optimize Browse drag-and-drop for large collections - #997
Open
devin-ai-integration[bot] wants to merge 2 commits into
Open
Conversation
…ry card Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
…oization holds Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This was referenced Jul 28, 2026
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.
Summary
Closes #981. Part of epic #975. Stacked on #996.
Profiled Browse tile dragging at production scale (production build + reorder fixture, real pointer drags via Playwright/CDP — harness committed as
scripts/profile_reorder_drag.py, full methodology and numbers indocs/reorder-performance.md).Diagnosis: long-task cost scaled with tile count and clustered at drag start/end —
handleDragStart/handleDragEndsetactiveItem(grid state), re-rendering all mounted tiles (600+ MUI cards) because tiles were re-created inline each grid render. Steady-state pointermove/collision cost was not dominant.Fix (memoization only — zero collision/drop-zone/activation changes,
docs/drag-and-drop.mdcontract untouched):ImageTile,CategoryTile→React.memoSortableTileGrid: tiles render through a memoizedGridTilewith stableuseCallbackrender props, so a tile re-renders only when its ownitem/index/disabledchangeMeasured (600-image gallery scope): drag FPS 43 → 50; long tasks 2/853 ms/486 ms → 1/368 ms; slowest pointer event 184 ms → 104 ms; heap 100 → 61 MB. The single remaining long task is dnd-kit's one-time shape measurement at drag activation; steady-state dragging has no long tasks.
Compact reorder mode: not implemented — the card grid meets responsiveness criteria at 600+ items after memoization (decision recorded in
docs/reorder-performance.md).Testing
frontend/tests/components/tileMemoization.test.tsx: parent re-renders with stable props do not re-executeImageTile/CategoryTile; prop changes still re-render.docs/reorder-performance.md.src/components/CanvasOverlay.tsx(from fix: correct Fabric text box resizing #984 on main) — untouched.Needs human verification
docs/drag-and-drop.md).Link to Devin session: https://app.devin.ai/sessions/414754bd88374dc693f47100ac269e78