If you do a timeout polling like this, it might be a good idea to bump up the timout to several minutes (not every 20 seconds like in the example code).
Peridically waking up an idle CPU just to check the time has a surprisingly big effect on power consumption. This might be a real issue if you have this page open in your smartphone browser but the phone is idle but not sleeping in your pocket.
I was under the impression that power mode switching took ~50 micro seconds, which means power savings modes toggle on an off between keystrokes.
The problem here isn't awaking the CPU, but rather awaking the radios. If you don't turn on the radios, polling every 20 seconds shouldn't be a problem. I'd mix this approach with something like the Page Visibility API, so you don't fetch data unless the site is the active tab.
[+] [-] exDM69|12 years ago|reply
Peridically waking up an idle CPU just to check the time has a surprisingly big effect on power consumption. This might be a real issue if you have this page open in your smartphone browser but the phone is idle but not sleeping in your pocket.
[+] [-] edwinvdgraaf|12 years ago|reply
[1]: http://www.paulirish.com/2011/requestanimationframe-for-smar...
[+] [-] jcampbell1|12 years ago|reply
The problem here isn't awaking the CPU, but rather awaking the radios. If you don't turn on the radios, polling every 20 seconds shouldn't be a problem. I'd mix this approach with something like the Page Visibility API, so you don't fetch data unless the site is the active tab.
[+] [-] lucb1e|12 years ago|reply
[+] [-] caludio|12 years ago|reply