perf(editor): replace lodash isEqual with optimized Set comparisons#7839
Merged
steveruizok merged 1 commit intoperformance-stack-1from Feb 4, 2026
Merged
perf(editor): replace lodash isEqual with optimized Set comparisons#7839steveruizok merged 1 commit intoperformance-stack-1from
steveruizok merged 1 commit intoperformance-stack-1from
Conversation
Replace expensive lodash deep equality checks with custom equality functions optimized for Sets and structured data: - Add setsEqual() that uses Set.has() for O(n) comparison instead of lodash's inefficient Set handling - Add arraysEqual() for reference equality array comparison - Add renderDataEqual() for structured comparison of indicator render data - Remove lodash isEqual imports from CanvasShapeIndicators and usePeerIds This fixes a major performance bottleneck in large multiplayer rooms where lodash's isEqual was doing expensive deep comparisons on Sets with thousands of shape IDs on every frame. Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
5 Skipped Deployments
|
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.
In order to fix a major performance bottleneck in large multiplayer rooms, this PR replaces expensive lodash deep equality checks with custom equality functions optimized for Sets.
lodash's
isEqualdoesn't handle Sets efficiently - it likely converts them to arrays for deep comparison. With thousands of shapes in large multiplayer rooms, this was causing significant performance overhead on every frame during the equality checks in computed signals.Change type
improvementTest plan
isEqualshould no longer appear in hot pathsRelease notes