Abnormal CPU Usage and Severe Main Thread Stutter on First Call to display() in CoreAnimationLayer #2555
Replies: 3 comments 1 reply
-
I created a new demo project and integrated the latest version of lottie-ios (4.5.1), but the stuttering issue persists. |
Beta Was this translation helpful? Give feedback.
-
Have you tried using the Main Thread rendering engine for this animation? The two rendering engines have different performance characteristics:
|
Beta Was this translation helpful? Give feedback.
-
I tried using the Main Thread rendering engine for this animation. which resulted in no lag during initialization but the frame rate stabilized around 25 fps during animation playback, an unacceptable trade-off. The Core Animation Engine, on the other hand, had a longer initialization lag (1040ms) but offered smooth playback without affecting frame rate. Using Time Profiler, I found that the most time-consuming methods were
Changing these method calls to static methods significantly reduced the lag. (1040ms -> 560ms)
Can I pre-process this calculation in a background thread beforehand? Or how should I inform the design department colleagues to optimize this animation file? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Environment:
Lottie-ios 4.4.1,
Xcode 16.3,
Swift 5,
tested on iPhone devices running iOS 16.3 and iOS 18.4.
Issue Description
After upgrading
lottie-ios
from version 2.5.3 to 4.4.1, a severe main thread stutter occurs during the first call toplay()
onLottieAnimationView
. The animation runs smoothly in version 2.5.3 with no stuttering. However, in 4.4.1, initializing the view and callingplay()
triggers a prolonged freeze (lasting several seconds) on the main thread. Once the freeze ends, the animation plays normally.Steps to Reproduce
LottieAnimationView
with the attached JSON.play()
.Attachments
player-audioReplay-vertical.json
Beta Was this translation helpful? Give feedback.
All reactions