gnosisguild / wand-nft

wand-nft.vercel.app
8 stars 6 forks source link

Improve performance of color wheel #41

Closed jfschwarz closed 2 years ago

jfschwarz commented 2 years ago

Turns out handlebars and the SVG update is already blazing fast, but we can significantly reduce the update cost by memoizing some parameter computations (in particular the astronomy math for calculating planet positions was expensive and ran on every render).

In addition to that I moved the throttling logic to the picker component and use requestIdleCallback and React 18's new useTransition to de-prioritize the global state update as much as possible. It still needs some extra throttling, but imo the current state feels acceptable. Wdyt?

jfschwarz commented 2 years ago

Turned out that the bottleneck is the GPU when updating the SVG gradients. So we have to conclude that we cannot significantly improve the situation 😞

Still going to push a new PR with some of the improvements from this branch.