Skip to content

Commit

Permalink
fix: Avoid potential slow Set#removeAll call in HierarchicalCommunica…
Browse files Browse the repository at this point in the history
…tionController#passivateInactiveKeys

The performance of calling Set#removeAll(List) is dependent on the relative sizes of the Set and List parameter. Replace Set#removeAll with List#forEach(Set::remove) to avoid this.

Fixes vaadin#13745
  • Loading branch information
pepijnve committed May 12, 2022
1 parent b182ea8 commit 5ffb289
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ private void passivateInactiveKeys(Set<String> oldActive,
}

// Finally clear any passivated items that have now been confirmed
oldActive.removeAll(newActiveKeyOrder);
newActiveKeyOrder.forEach(oldActive::remove);
if (!oldActive.isEmpty()) {
passivatedByUpdate.put(Integer.valueOf(updateId), oldActive);
}
Expand Down

0 comments on commit 5ffb289

Please sign in to comment.