flutter_confetti icon indicating copy to clipboard operation
flutter_confetti copied to clipboard

Would optimizing with SIMD friendly typed lists work?

Open antont opened this issue 8 months ago • 0 comments

EDIT: just realized the this already uses vector_math for the types, just not in arrays. I could experiment and see if it affects the perf, I think it does via memory layouts.


Hi, and thanks for the nice package, we just started using it and the perf is probably fine for the 100 particles we use now.

However I'm curious, would it work to optimize this by making the particle positions and velocities SIMD friendly typed lists, and using array operations to apply the updates to those in one go? I think that's how particle systems are often made, and how e.g. numerical python achieves great performance with array operations.

I could try this out for fun, also to learn a bit for Dart and Flutter, if it would make sense.

Am thinking the particle data arrays could use https://api.dart.dev/stable/3.1.3/dart-typed_data/Float32List-class.html

And maybe use this lib for operations, https://pub.dev/documentation/vector_math/latest/vector_math_operations/Matrix44SIMDOperations/multiply.html

antont avatar Oct 13 '23 06:10 antont