PDA

View Full Version : loading spinner pegging the CPU?



mherger
24 Jan 2011, 3:42 AM
While a LoadMask is shown with the loading spinner, CPU load on a static screen is around 90% on my HTC Desire. Without the spinner it's <2%. Is this to be expected? Would replacing the CSS animation with an animated GIF help the cpu load?

This can be an issue if the background task itself is requiring a lot of processing. I have a case where I'm handling a thousand records in an SQLite DB. This seems to be slower with the spinny than without it.

mitchellsimoens
24 Jan 2011, 7:59 AM
Correct me if I'm wrong but the Desire has a 1GHz CPU right? My Evo (1GHz also) doesn't have a problem at all. In fact, my iPod (last year's model) doesn't have a problem with LoadMask.

mherger
24 Jan 2011, 8:05 AM
I think this only becomes an issue if the process running in the background is hard on the CPU as well. Waiting for a server to send a reply etc. is no problem at all of course.

I did run into a situation where the spinny wouldn't go away any more. In that case Android started to complain about the cpu being pegged. I wasn't able to even stop the app any more, had to reboot the device. I've never been able to reproduce that particular problem, but running top I'm seeing the CPU load as soon as the loadmask is shown.

And I wouldn't be surprised if this wasn't an issue on iOS at all, as it's using the GPU for CSS animations (afaik), which Android is not.

mitchellsimoens
24 Jan 2011, 8:29 AM
Right, but my Evo is pretty much the same as your Desire

mherger
24 Jan 2011, 8:49 AM
did you compare a busy task with and without it?

mitchellsimoens
24 Jan 2011, 8:50 AM
It shouldn't matter... it's basically a few divs with CSS3... pretty inexpensive

mherger
24 Jan 2011, 9:00 AM
Well, obviously it's not :-). You'd notice if you compared.

mitchellsimoens
24 Jan 2011, 9:07 AM
In your first post, you say you are handling a thousand records in a SQLite db... I am running just the spinner and it doesn't taxi my Evo at all. So this would tell me that it's the handling of the db records that is taxiing your phone, not the spinner.

mherger
24 Jan 2011, 9:14 AM
I'm sorry I don't understand the term "taxi" :-) (non EN speaker here). Do you mean it doesn't lock up?

I did run the mask on static page test as well. Load is around 90% whereas without the mask it would be <2%.

mitchellsimoens
24 Jan 2011, 9:17 AM
I'm sorry, taxi means put strain on.

So you ran it on a static page and it was 90% CPU usage? Have you restarted your phone and tried again?

This is what I have and I couldn't notice a difference in performance:



Ext.setup({
fullscreen : true,
onReady : function() {
var mask = new Ext.LoadMask(Ext.getBody(), {msg:"Please wait..."});
mask.show();
}
});