Notebookcheck Logo

Bloated Code May Drain Your Smartphone Battery

Teaser
Overly large CSS pages and other unused website code may drain your smartphone's battery.

At the 2012 World Wide Web Conference, Stanford University researchers have presented a means for measuring the energy consumption of wasteful code from websites, and have found that popular sites like Wikipedia and Apple have not optimized their code for mobile browsing. By attaching a multimeter between an Android phone and its battery, Narendran Thiagarajan and others were able to measure nearly instantaneous power consumption while the phone was in use.

The energy consumption, measured in Joules or as a percent of battery life, showed large differences between energy-efficient homepages like Baidu, Gmail, and the Wall Street Journal, (about 12 Joules) against Tumblr and Wikipedia (about 35 Joules). Apple’s homepage had the highest energy consumption measured, at 45 Joules, or about 1.4% of battery life.

These measurements were compared to energy consumption when the browser was idle, and accounted for differences in web server performance by placing copies of the respective home pages on a single Apache remote server. Measurements were made using a 3G network. Separate measurements of the energy used to render each page were made by forcing the browser to use the local cache.

Looking at the individual web components, the Stanford group found that CSS and Javascript are often the most energy intensive components of a web site. The energy used to download and render images was surprisingly small, compared to computer code. Moreover, bloated code was largely the culprit for large energy use: in most cases, the large CSS and Javascript files contained code that was never used.

To prove that more efficient code would reduce energy use, they removed unused Javascript code for Wikipedia, and the unused CSS rules for Apple. The revised page for Apple reduced energy consumption by 5 Joules, and Wikipedia’s by 5.5 Joules. They conclude that using generic libraries “simplifies web development, but increases energy used by the resulting pages.” Formatting images in JPEG format (as opposed to GIF or PNG) also resulted in more energy efficient use, at least for the Android platform.

While energy efficiency has been used for desktop computers and servers, the authors present findings that could have practical applications for mobile browsing. By designing mobile sites that take energy consumption into account, smartphone users may benefit from longer battery life.

Source(s)

Read all 1 comments / answer
static version load dynamic
Loading Comments
Comment on this article
Please share our article, every link counts!
Franzl, 2012-04-28 (Update: 2012-05-26)