Using CoreAnimation Engine Layer also blocks main thread when animation is set #1886
aakarsh-sasi
started this conversation in
General
Replies: 1 comment 7 replies
-
I'd say this is generally expected, since it does take some amount of work on the main thread to set up and configure the Core Animation rendering engine's We have test cases comparing the initialization performance of the Core Animation rendering engine compared to the Main Thread rendering engine and they show that the CA engine is usually about 2x as expensive to initialize (optimized from 4-5x originally). |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Using core animation engine has improved the performance far more, no animations get stuck while playing anymore and it feels really great to use it
We were trying to go a little overboard and try to use animation inside table view cells (all cells with lottie animations)
We noticed whenever we set:
lottieAnimationView.animation = animation
there is a spike on the main thread and leads to stutter in scrolling experience. I know using Lottie in every cell was never the purpose it was intended for 😅
We managed to decrease the time it takes on main thread by using the DefaultAnimationCache and dictionary Based Decoding (from 4.0.1)
Checked a bit in code and the time is mostly taken on
makeCoreAnimationLayer
Is it possible to optimise it any further through any workaround? (We tried setting the animation on a background thread but that didn't work)
Adding the screenshot for the profiler:
Which Version of Lottie are you using?
Lottie 4.0.1
Expected Behavior
60 FPS if possible :p
Actual Behavior
Frames drop to 8-10 fps if I scroll really fast
Animation JSON
Beta Was this translation helpful? Give feedback.
All reactions