Left-on-Read / leftonread

Left on Read
https://leftonread.me/
Other
173 stars 17 forks source link

perf: slow animations #453

Closed amilajack closed 2 years ago

amilajack commented 2 years ago

i noticed animations are a bit slow, even when i'm on a m2 mac.

palette tells us:

  1. useEffect runs in render loop
  2. querySelector runs in render loop
  3. WrappedGradient isn't memoized

i'm happy to PR a fix for this

Profiles

https://profiler.palette.dev/from-url/https%3A%2F%2Fpalette.dev%2Fapi%2Fprofiler%3Fid%3Dcl8j2xvzc014808mqjicwi9v8%26version%3D378448a%26session%3Dbao46pfxwpo%26instance%3Di%26start%3D2022-11-08T00%253A00%253A00.000Z%26end%3D2022-11-09T00%253A00%253A00.000Z/calltree/?globalTrackOrder=01&hiddenGlobalTracks=1&thread=0&timelineType=category&v=7

Screenshot 2022-11-07 at 10 48 13 PM Screenshot 2022-11-07 at 10 46 51 PM
alexdanilowicz commented 2 years ago

Hey @amilajack, thanks for flagging. I've also seen the background gradient animation act funky and slowly on my M1 sometimes (usually when I'm developing/hot reloading stuff), so checks out.

You're totally welcome to open a PR to improve these animations if you want. And then we can see if Palette notices the improvement! We'd just ask that the core animation still works/looks good on the Wrapped section.

We probably won't prioritize fixing the animations ourselves considering we haven't heard any complaints from users... yet