flutter-wonderous-app icon indicating copy to clipboard operation
flutter-wonderous-app copied to clipboard

Reduce Widget rebuilds on WonderEditorialScreen

Open kenzieschmoll opened this issue 3 years ago • 3 comments

Confirmed with the Widget rebuild stats tool in IntelliJ that this reduces unnecessary widget rebuilds. If a widget is completely transparent (opacity 0), there is no value for rebuilding and rendering - only cost. This PR reduces that.

kenzieschmoll avatar Sep 15 '22 21:09 kenzieschmoll

Do you have before and after stats for how this impacts frame render times? Not all rebuilds are bad only ones that lead to Flutter doing a lot of work rebuilding or rendering.

jacob314 avatar Sep 15 '22 21:09 jacob314

These changes appear to have slightly improved both. This sort of A / B testing in general is a gap in our tooling. I manually hacked this calculation into DevTools and did my best to reproduce a consistent set of frames, but this isn't a great user experience.

before: Avg Build = 0.7154471544715447 Avg Raster = 6.065040650406504

after: Avg Build = 0.6283185840707964 Avg Raster = 5.212389380530974

It does "feel" a tad smoother, too. Perhaps theres a bit of a latency decrease between frames that is difficult to measure with our tools.

kenzieschmoll avatar Sep 15 '22 22:09 kenzieschmoll

If the raster improvement holds up after more precise measurement that is a a pretty big improvement.

jacob314 avatar Sep 16 '22 17:09 jacob314