Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poor performance during scrolling even when animation is stopped #1105

Closed
4 tasks done
IzikLisbon opened this issue Dec 24, 2019 · 4 comments
Closed
4 tasks done

Poor performance during scrolling even when animation is stopped #1105

IzikLisbon opened this issue Dec 24, 2019 · 4 comments

Comments

@IzikLisbon
Copy link

Since performance is poor when scrolling (See #852), I have tried to work around it by stopping animation during scrolling.
However, performance stayed low even when the animation stopped.

To repro it I have created an app with 3 pages where every page has a Lottie animation.

With Core Animation profiling I have tried 3 scenarios:

  1. Scrolling when Lottie is animating
  2. Scrolling when Lottie is stopped
  3. Scrolling when Lottie is replaced with a UIImage.

Here are the results:
image

setting shouldRasterizeWhenIdle to true had no affect.

Check these before submitting:

  • The issue doesn't involve an Unsupported Feature
  • [] This issue isn't related to another open issue

This issue is a:

  • Non-Crashing Bug (Visual or otherwise)
  • [] Crashing Bug
  • [] Feature Request
  • [] Regression (Something that once worked, but doesn't work anymore)

Which Version of Lottie are you using?

Lottie 3.1.5

What Platform are you on?

  • [] MacOS
  • iOS

What Language are you in?

  • Swift
  • [] Objective-C

Expected Behavior

When scrolling, if animation is stopped, FPS (Frame Per Second) should stay high and Device Utilization should stay low. I am expecting the same performance as if Lottie would be replaced with a static UIImage.

Actual Behavior

Regardless of animation state (running/stopped) the performance is low.

Code Example

Test app: https://github.com/IzikLisbon/lottie-performance-bug

A simple app with 3 pages where every page has a Lottie animation.
Also expose 2 buttons:

  1. Remove/Add Lottie
  2. Stop/Play Lottie

Note: the app was tested with a much bigger JSON file and the profiler screenshot above was created with that file but even the committed Animation JSON shows that Device Utilization stays high when animation is stopped (but the FPS stays stable above 55).

Animation JSON

https://github.com/IzikLisbon/lottie-performance-bug/blob/master/lottie_performance_bug/animations/medium_animation.json

@IzikLisbon
Copy link
Author

Observation: there are recursive calls to updateContents during scrolling even when animation is stopped:
recursive_call_to_updateContents

@Rapsssito
Copy link
Contributor

Might be related to #895

@IzikLisbon
Copy link
Author

@Rapsssito it might be the same root cause as #895, however this issue is about scrolling when animation is stopped. Other issues refers to animation performance or scrolling performance when animation is running.

@calda
Copy link
Member

calda commented Jul 6, 2022

Today we released Lottie 3.4.0 which includes a new rendering engine powered by Core Animation (more details here). This new rendering engine has significantly better performance, and should resolve the performance issues folks have been encountering with the previous main thread rendering engine. Please try it out by setting the LottieConfiguration.renderingEngine feature flag, and feel free to report any new issues that you experience when using the new rendering engine.

@calda calda closed this as completed Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants