Skip to content

perf(cdk/drag-drop): fix performance regression when destroying items #30751

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2025

Conversation

crisbeto
Copy link
Member

#30514 changed the logic that syncs destroyed items to apply to non-dragged items as well. This led to a performance regression where swapping out a large list of items can lock up the entire browser. The problem is that the items need to be re-sorted each time an item is destroyed which is expensive.

These changes resolve the issue by keeping track of the last set of items and dropping the item from it without re-sorting.

Fixes #30737.

angular#30514 changed the logic that syncs destroyed items to apply to non-dragged items as well. This led to a performance regression where swapping out a large list of items can lock up the entire browser. The problem is that the items need to be re-sorted each time an item is destroyed which is expensive.

These changes resolve the issue by keeping track of the last set of items and dropping the item from it without re-sorting.

Fixes angular#30737.
@crisbeto crisbeto added the target: patch This PR is targeted for the next patch release label Mar 31, 2025
@crisbeto crisbeto requested a review from a team as a code owner March 31, 2025 08:26
@crisbeto crisbeto requested review from andrewseguin and wagnermaciel and removed request for a team March 31, 2025 08:26
@angular-robot angular-robot bot added area: performance Issues related to performance area: cdk/drag-drop labels Mar 31, 2025
@crisbeto crisbeto removed the request for review from andrewseguin March 31, 2025 15:55
@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Mar 31, 2025
@crisbeto crisbeto merged commit 1372f52 into angular:main Mar 31, 2025
24 of 27 checks passed
@crisbeto
Copy link
Member Author

The changes were merged into the following branches: main, 19.2.x

crisbeto added a commit that referenced this pull request Mar 31, 2025
…#30751)

#30514 changed the logic that syncs destroyed items to apply to non-dragged items as well. This led to a performance regression where swapping out a large list of items can lock up the entire browser. The problem is that the items need to be re-sorted each time an item is destroyed which is expensive.

These changes resolve the issue by keeping track of the last set of items and dropping the item from it without re-sorting.

Fixes #30737.

(cherry picked from commit 1372f52)
szoboszlaypali pushed a commit to szoboszlaypali/components that referenced this pull request Apr 1, 2025
…angular#30751)

angular#30514 changed the logic that syncs destroyed items to apply to non-dragged items as well. This led to a performance regression where swapping out a large list of items can lock up the entire browser. The problem is that the items need to be re-sorted each time an item is destroyed which is expensive.

These changes resolve the issue by keeping track of the last set of items and dropping the item from it without re-sorting.

Fixes angular#30737.
mistrykaran91 pushed a commit to mistrykaran91/components that referenced this pull request Apr 7, 2025
…angular#30751)

angular#30514 changed the logic that syncs destroyed items to apply to non-dragged items as well. This led to a performance regression where swapping out a large list of items can lock up the entire browser. The problem is that the items need to be re-sorted each time an item is destroyed which is expensive.

These changes resolve the issue by keeping track of the last set of items and dropping the item from it without re-sorting.

Fixes angular#30737.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker area: cdk/drag-drop area: performance Issues related to performance target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(drag-and-drop): disconnecting drop list is really slow after version 19.1.5
2 participants