flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
165.62k stars 27.34k forks source link

Potential Matrix4Tween.lerp performance improvement #32055

Open rakudrama opened 5 years ago

rakudrama commented 5 years ago

The third benchmark here demonstrates how to modify Matrix4.lerp to run about 25% faster by reusing objects rather than allocating new ones. https://github.com/google/vector_math.dart/commit/4e83308a916339fa2f404945ca4efd994e1c5830#diff-1465efa00171ab51942972af0e358965R92 This works because of Dart's microtask execution model - the reuse all happens during the same microtask.

You could do better than this by lazy pre-decomposition if the begin and end are stationary, but that would require each Tween to hold the decomposition.

chinmaygarde commented 4 years ago

Triage: This doesn't seem like an engine issue. cc @Hixie @goderbauer