azchohfi / LottieUWP

UWP port of Lottie(https://github.com/airbnb/lottie-android)
Apache License 2.0
274 stars 45 forks source link

CPU load #15

Closed corradocavalli closed 6 years ago

corradocavalli commented 6 years ago

A simple Lottie Animation uses about 3/4% of CPU increasing the number to 5 even with caching we reach more than 30%. Is there a way to make CPU load smaller?

azchohfi commented 6 years ago

Only by reducing the FPS. The way the animations works is totally bound to the CPU(path calculation, progress and keyframes calculations, etc). There is work that can be done to cache some calculations, but not much.

azchohfi commented 6 years ago

I tried having this much CPU on a blank app with a gridview and LottieAnimationView, but I got 30% only with 100 animations on screen. It really will depend on the animation. And your CPU ;)

corradocavalli commented 6 years ago

I tried with the preloader animation (from LottieFiles) and with 5 cpu reached 40%. I started checking cpu load after i got a comment on my post by a user that told me that he gived up using the library because of too much cpu and memory pressure. I have a quite powerful machine, but i have to consider the worst situation first. :-)

On 25 Feb 2018, at 10:12, Alexandre Zollinger Chohfi notifications@github.com<mailto:notifications@github.com> wrote:

I tried having this much CPU on a blank app with a gridview and LottieAnimationView, but I got 30% only with 100 animations on screen. It really will depend on the animation. And your CPU ;)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/azchohfi/LottieUWP/issues/15#issuecomment-368294451, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFW5Eu9IkRg_VmsCayLvYikW0yi87q6kks5tYSP5gaJpZM4SR8Pl.

azchohfi commented 6 years ago

Version 2.5.0 (the one on NuGet) removed tons of memory leaks, so that should not be a problem anymore.

azchohfi commented 6 years ago

Have you tried the latest from MyGet? It should also fix the Speed on XAML.

azchohfi commented 6 years ago

I'm going to close this for now, since it's a hard thing to track and https://github.com/azchohfi/LottieUWP/commit/b4dc63209805eb2111b6e32053cfffc1c303194b probably helped a lot with CPU/GPU .

corradocavalli commented 6 years ago

Tested now, CPU load went to 40% to less than 2% with 5 animations, super well done!