PrimeTween vs DOTween Performance Comparison #8
KyryloKuzyk
announced in
Announcements
Replies: 1 comment 2 replies
-
Recently I also saw a new tween library called Magic Tween. In addition to being based on ECS, it also supports traditional implementations. Can you do a test comparing Prime Tween with it?. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
PrimeTween vs DOTween Performance Comparison
All benchmarks in this article are performed with the official Performance testing API and can be easily replicated by cloning the Benchmarks repo.
Before jumping to exact numbers, let's discuss quick takeaways:
Runtime Performance
GC Memory Allocations
Zero-allocation is the cornerstone of PrimeTween's design. PrimeTween never allocates GC and never produces micro-freezes that can worsen the player's experience.
DOTween allocates on each animation and delay start. This is the reason why tween caching like in the DOTweenWindow.cs example is a very common pattern among DOTween users. This usage pattern not only makes the code more complicated but has a runtime performance downside - cached tweens still receive an update every frame and consume memory.
Another option to reduce GC pressure with DOTween is to enable the ‘Recycle Tweens’ setting. This setting should be used very cautiously because every tween reference you store will be recycled and used for new tweens, which can lead to unpredictable and hard-to-detect bugs. Animation recycle (1*) includes the OnKill() callback that clears the tween reference so it doesn't point to a wrong one in the future. Animation recycle (2*) shows the usage without storing the tween's reference.
Conclusion
This concludes the performance comparison, the next one on my roadmap is to compare PrimeTween with other tween libraries. For now, I welcome everyone to clone the Benchmarks and play with the tests yourself. After cloning the repo, open the 'Window/General/Test Runner' and run the tests on the target platform by pressing the 'Run All Tests (TargetPlatform)' button.
All tests were performed with the
PRIME_TWEEN_DISABLE_ASSERTIONS
define. PrimeTween heavily uses assertions in development builds, and this define will disable them to match the release performance in tests.Spotted an error in the measurement method? Or have something to add? You are welcome in the comments!
Beta Was this translation helpful? Give feedback.
All reactions