The algorithm used to generate unique names for tracks is incredibly wasteful. It iterates over TrackAsset names N^2 times, and each call to Object.name allocates.
Creating a Timeline of 50 tracks allocates 1.5 MB just for name uniqueness.
Creating a Timeline of 1024 tracks allocates 2.71 GB just for name uniqueness.
This is pretty bad in the Editor, but this code also runs at Runtime.
Steps to reproduce:
- Open a project with Timeline Package
- Add the attached AnimationUpdatePerfTest script to the project
- Run the test with the profiler open
- Observe the allocations
Actual results: Timeline Allocates a very large amount of memory
Expected results: Timeline allocates a minimal amount of memory
Reproducible with versions:
Not reproducible with versions:
Can’t test with versions:
Tested on (OS):
Notes: