hnvn / flutter_shimmer

A package provides an easy way to add shimmer effect in Flutter project
BSD 3-Clause "New" or "Revised" License
1.77k stars 200 forks source link

Extremely high CPU usage causing phone to overheat #64

Open paplorinc opened 1 year ago

paplorinc commented 1 year ago

It seems that shimmering causes a ~40-60% CPU usage when running:

It's so severe that my phone overheats.

If I give it a stopping condition (i.e. loop: 2), it's reduced considerably:

dmitry-grin commented 1 year ago

"Use one [Shimmer] to wrap a list of [Widget]s instead of a list of many [Shimmer]s"

Make sure you are not having little shimmers animating themselves instead you need to have parent shimmer, applying animation over multiple containers/placeholders

paplorinc commented 1 year ago

Even a single one was causing it - is there a busy wait underneath? A simple animation like this shouldn't cause the overheating. If there is, maybe even a tiny sleep (or a https://api.flutter.dev/flutter/scheduler/Ticker-class.html, maybe, not sure) could solve the warming...

reza00farjam commented 1 year ago

Hi everyone! Any updates?

soheb12 commented 1 year ago

Interesting, I found similar spike in CPU usage. Were you able to figure out the root cause? I've incorporated @dmitry-grin's feedback but is there anything else we can do to reduce the CPU usage?

istornz commented 11 months ago

Same here ...

joaopmarquesini commented 10 months ago

Do any of you experience this overheating on Android? I'm facing the same issue but seems to be happening only on iOS. Also trying to figure out is this could be an Impeller issue.

giantss commented 10 months ago

Same here ...

splimter commented 8 months ago

Same here with shimmer: ^3.0.0

bahiraei commented 8 months ago

this is very bad!

b099l3 commented 4 months ago

Came across this issue after our users have reported our app is draining battery life and phone getting hot, only on iOS? Similar to @joaopmarquesini

Is there away round this or it is due to using multiple shimmers on the one view?

joaopmarquesini commented 4 months ago

@b099l3 from what I tried, even if I used a single shimmer but had it constantly on screen (I was using it on animations for a gaming app) the phone would overheat.

b099l3 commented 4 months ago

Slightly unrelated but also good to know for others. We also use Intercom in our app and this issue also mentioned high CPU load. I updated Intercom to 16.5.4 it out and it massively dropped our CPU usage 120-130% to 30-40% 🤯

BEFORE

imp-eng imp-cpu

AFTER

Screenshot 2024-03-13 at 11 06 13 Screenshot 2024-03-13 at 11 06 05
istornz commented 4 months ago

On my side, I have set the loop to 1 as a temporary workaround. Now the shimmer only play 1 time, I don't have any CPU issues now.

imajercsik commented 1 month ago

Same here on Android, any updates?