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

Performance regression on Lottie 3 #895

Closed
6 of 10 tasks
manolosavi opened this issue Apr 26, 2019 · 28 comments
Closed
6 of 10 tasks

Performance regression on Lottie 3 #895

manolosavi opened this issue Apr 26, 2019 · 28 comments

Comments

@manolosavi
Copy link

manolosavi commented Apr 26, 2019

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.0.4

What Platform are you on?

  • MacOS
  • iOS

What Language are you in?

  • Swift
  • Objective-C

Expected Behavior

Same or improved performance as previous versions of Lottie when running animations

Actual Behavior

Running an animation on a loop using Lottie 2.5.3 consumes around 16% CPU, while running that same animation on Lottie 3.0.4 consumes around 43%

Code Example

Animation JSON

Attached file

@buba447
Copy link
Collaborator

buba447 commented Apr 26, 2019

Duplicate of #832 and #828

@manolosavi
Copy link
Author

@buba447 for what its worth we also tried installing off of master today and we didn't see any difference in CPU usage

@buba447
Copy link
Collaborator

buba447 commented Apr 26, 2019

I imagine there wouldnt be any difference. I havent had a chance to deep dive into the performance issues yet. The issues will be updated when I do though!

@alexbredy
Copy link

Same issue here. I am updating the currentProgress property of a Lottie animation on scrollViewDidScroll (creating a parallax offset) and performance dropped a lot since we migrated from v2 to v3. CPU consumption jumps making the frame rate drop.

@manolosavi
Copy link
Author

@buba447 hi! just wanted to let you know that I just tried out version 3.1.2 and there are still issues in this version. The same screen shows CPU utilization of ~45% on 3.1.2 vs ~18% on 2.5.3, and the reported "energy impact" is "very high" vs "high".

@buba447
Copy link
Collaborator

buba447 commented Aug 22, 2019 via email

@manolosavi
Copy link
Author

@buba447 thank you!

@Rapsssito
Copy link
Contributor

Rapsssito commented Oct 15, 2019

Any news on this issue? I am experiencing 1 FPS frame drops with any animation on iOS, while they perform solid 60 FPS on Android (using lottie-react-native).

@paolo96
Copy link

paolo96 commented Oct 27, 2019

I'm experiencing this issue too, any news? @buba447

@kirillsh
Copy link

+1
version 3.x is disappointing from performance point of view, have to downgrade to 2.5

@antonioallen
Copy link

Yeah, extremely poor performance CPU at 90% and memory when from 65mb to 1.2GB. Going to try downgrading as @kirillsh suggested.

@fila
Copy link

fila commented Nov 14, 2019

Having an issue with Memory usage while utilising the latest Lottie version (3.1.3). Tried to downgrade to 2.5.3, but this didn't actually help:

  • the memory usage is the same (even went up a bit from 503.4 MB to 506.6 MB)
  • the CPU usage did drop, but insignificantly: from avg. 7% to avg. 3%

@flypigo00o
Copy link

I have same problem.
I used for 2.5 downgrade.
But I worry that Apple's fast update cycle will make 3.0 updates inevitable.
I will continue to care about this problem. Any news on this issue?

@buba447
Copy link
Collaborator

buba447 commented Nov 20, 2019

Hey Everyone!

Some updates here. Ive tracked down some of the performance issues. The main issue comes from the way swift handles automatic memory management for structs and generics. Apparently there is a lot of overhead for swift memory management. This is increasing the memory footprint as well as causing a massive performance hit. The good news is that this is a fixable problem. The bad news is that it requires a refactor to remove generics and to rethink the usage of structs in many situations. This would be a fairly massive project.

For those that don't know, Im the sole developer and maintainer of Lottie-ios. I did the swift rewrite last year (also I wrote the objc version before that) and am continuing to maintain this project in my free time. I am not employed by Airbnb so add an emphasis to the word free in free time. As you can imagine finding time to work on such a large project when I have paying contractor jobs waiting around is difficult. I'm hoping to raise some funds to tackle this refactor using github-sponsors. If you or anyone you know would be interested in sponsoring this project, please share this repo! theres a sponsor button right at the top ^

Thanks for using Lottie and for keeping me posted on everything going on. I have created a project for this issue and will be tracking progress there. The progress is attached to this issue.

@Rapsssito
Copy link
Contributor

Rapsssito commented Nov 21, 2019

@buba447, greatly appreciate your work. I would sponsor the project if I could. Please, consider pinning an issue with some TODOs so we, the community, can help you with this refactoring!

@yuweipei
Copy link

any updates on the sponsorship or the TODO list that the community can help out?

@dreampiggy
Copy link

Any update about this issue ?

In some test lottie images, the performance drop down is 60% compared to Lottie 2.x. See: SDWebImage/SDWebImageLottiePlugin#1

Our wrapper framework now have to use Lottie 2.x instead of 3.x because of this poor performance.

@ppamorim
Copy link

ppamorim commented Mar 5, 2020

I am experiencing the same. Please help :)

@dreampiggy
Copy link

dreampiggy commented Mar 9, 2020

I've tried another solution, I integrate Samsung's rlottie implementation on iOS/macOS/tvOS/watchOS.

The rlottie's performance is good on production, however, it support bitmap rendering only. Each time you change the canvas size, you need to re-render. This means you need to use UIView's drawRect method if you want dynamic size changing.

If you're using SDWebImage already, have a try SDWebImageLottieCoder, which play the best performance on massive UICollectionView layout. Suitable for small stickers (which don't need vector size changing)

If you don't use SDWebImage, don't worry, you can still integrate the rlottie using our wrapper rlottie-Xcode, which provide both CocoaPods/Carthage/Swift Package Manager support, make it easy for life without C++ cross-compiling issue... 😪

normanzb added a commit to normanzb/lottie-react-native-gai that referenced this issue Apr 25, 2020
…tie-android the latest (at the time of forking).

The motivation of the hack is because of the bad performance of lottie-ios 3, which is the result of excessive usage of struct. For our case, the performance is so bad that when lottie animation is playing in the background, it almost freezes the app.

You can find out more about [the issue here](airbnb/lottie-ios#895).
@Yamyee
Copy link

Yamyee commented Apr 26, 2020

Is there a better way than downgrading?

@david6p2
Copy link

Hi @buba447 do you have a TODO list of the tasks that needs to be done, so some of us can help you out.

@rkeshavappa
Copy link

@buba447 Any solution on how to fix the performance hit ? We are using a Lottie file which is spiking up the memory to 40MB and there a good amount of lag on load.

@ddcrobert
Copy link

ddcrobert commented Sep 10, 2020

Not really a solution but might help in some cases...
The AE compositions provided by my designer were huge, like 2000x2000. Even if that's vectors... the lottie view has to be downscaled to match the constraints. The more it had to downscale, the more the performance were poor.
Reduced the composition (File/Script/Demo Palette) from 2000x2000 to 100x100.

@Tr736
Copy link

Tr736 commented Sep 29, 2020

@ddcroberts solution didn't work for me either. Ive had to roll back to 2.5.3 which works but doesn't support as much AE effects. Shame, hope this is resolved soon

@andemengo
Copy link

@buba447 any updates? Could we help you to fix this issue?

@MazZilaaaa
Copy link

Any updates?

@paolo96
Copy link

paolo96 commented Mar 29, 2021

#1328 this seems to solve the issue, @buba447 can you give us an update regarding this? thanks

@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