Skip to content

Conversation

@nyan-left
Copy link
Contributor

@nyan-left nyan-left commented Dec 15, 2025

Every property read (e.g. backgroundColor) was sorting the layer list to find the winning value.

With 150 panels × ~20 properties = 3000 sorts. O(N * P)

Solution

Sort once, cache the result. Only re-sort when layers actually change. O(1)

@bbohlender
Copy link
Contributor

@nyan-left thanks

Did you make this change because you analysed the performance in a real app?

@nyan-left
Copy link
Contributor Author

Profiled some rerenders with dev tools, noticed that the sorts are happening needlessly.

@bbohlender
Copy link
Contributor

Did you confirm that there's a performance improvement, especially for introducing the "Set"? Since arrays vs set performance mostly only matters for really large entries, in my experience, and I'd rather only introduce complexity for a verified performance gain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants