4 ms·
Where everyone seems to be focused on performance, it strikes me that performance is just the flip side of efficiency, and that asm.js might be a great way to s
by joblessjunkie 14y ago
Where everyone seems to be focused on performance, it strikes me that performance is just the flip side of efficiency, and that asm.js might be a great way to stretch battery life on mobile. Will asm.js web pages run with less power than traditional JS? Also I suspect this can help with the sluggish performance of mobile browsers in general.
- wmf 14y agoYes, code that runs faster also uses less battery.
- kevingadd 14y agoWell, not always, but it's pretty safe to assume that if a program completes in 1 second instead of 10 seconds, it's gonna use less power. Modern CPUs tend to be able to adjust their clock speed in response to load, and I think there are even some shipping processors that can switch off entire cores. GPUs are the same way. In practice, running an asm.js version of some normal JS might load your CPU more evenly and use more of its resources, but it's going to run so much faster that you should come out ahead. The power draw (measured at the wall by my UPS) from my current desktop PC can bounce from 100W to 400W at the drop of a hat (from the GPU and CPU both clocking up, respectively). So, in that case, code that 'runs faster' (by using the GPU) could potentially actually use more power. But I bet in practice most GPGPU applications end up using less power in total too since they run so much faster.
- wmf 14y agoRunning faster may use more power but it generally uses less energy which is the constraint in a battery-powered device.
- rictic 14y agoAgreed. Summarized in the phrase "race to sleep" - see http://en.wikipedia.org/wiki/Dynamic_frequency_scaling http://en.wikipedia.org/wiki/Dynamic_frequency_scaling
- kristiandupont 14y agoAlso, concurrent programs that use lock-free algorithms might perform better than locking ones, but they keep the CPU spinning while waiting to complete and thus may use more power as well.