January 14, 2009

green code

Netbooks, cell phones and other battery-powered devices are quickly becoming a popular way to access the web. I wonder how different kinds code impact the battery usage of these gadgets. A recent experiment showed that web pages using Flash sucked more power than pages with html and javascript alone. It says that “ajax” uses almost as much as Flash. I would presume he is talking about making additional URL request after the page loads. I can see where using the network would be a power drain.

JavaScript can be used to reduce power consumption for mundane tasks like rotating banner ads, running a “what’s new” section, or offering a photo slide show. Browsers are also getting much better at running JavaScript. Recent advances have lead to several times-fold increases in performance. This is good new for the battery life as well. If the JavaScript engine can run more efficiently, it has to draw less CPU power.


This got me thinking about performance tuning;
If you can make code that runs faster, it more likely than not uses fewer CPU executions.

takeaway:
Performance testing and optimization will not only speed up your app/page, it reduces greenhouse gasses and increases battery life.