Scientists are saving the planet by coding green

April 20, 2022

(News from Nanowerk) Climate change has forced humanity to think differently in order to preserve the planet and every living thing. A wide variety of technologies and services that conserve natural resources have emerged around the world, thanks to research and innovation efforts. We now have zero-emission vehicles, smarter, more efficient appliances, green packaging made from biodegradable plastic, and even lab-grown meat. What about software? Can an app also be green?

Applications – and anything programmed – can actually be more or less efficient and require more or less power to perform their tasks. And if an inefficient application doesn’t shock you, imagine if all of Google’s servers consumed twice as much energy as they do today, due to poor optimization. It’s all about scale.

A group of researchers from the Institute of Systems and Computer Engineering, Technology and Science (INESC TEC) and the University of Minho are focusing on this exact point: to ensure that the software of everything that surrounds us is coded as efficiently as possible.

“We want to raise awareness and help programmers build more durable and robust solutions,” said João Saraiva, researcher at INESC TEC and professor at the University of Minho. “How, exactly? you might ask?

write more effectively

The group has published a scientific publication (“Android Greenspecting virtual keyboards”) where they compared the effectiveness of different Android keyboard apps, such as Google Keyboard (GBoard) and Microsoft SwiftKey. Because smartphones run on battery power, the entire system must be as efficient as possible to extend battery life as much as possible.

“In fact, replacing the most power-hungry keyboard with the most eco-friendly reduced power consumption by 18%, and when advanced features of these keyboards (word prediction or animations) were disabled, power consumption was also reduced in this case. cases, up to 9.3%,” wrote researchers Rui Rua, Tiago Fraga, Marco Couto, and João Saraiva.

What if we consider the smartphone as a whole, instead of a specific application? With this in mind, the team has also developed GreenHub, an Android application capable of measuring the electricity consumption of smartphones. Data collected from the app analyzed the battery consumption of 23 million samples, spanning over 1,600 device brands, 11,800 smartphone models and over 50 Android versions. , which gave rise to this publication.

The authors were able to find charging/discharging trends across different countries, observable battery trends between brands and models, and battery usage improvements between Android versions. They also looked at how some of the most popular apps like Facebook, Facebook Messenger, and Facebook Lite (now called Meta) fare in terms of battery consumption trends.

In addition to studies focused on the analysis of energy consumption, the group is also dedicated to the development of tools and methodologies to estimate the energy consumption of software. “The development of such artifacts is driven by the need to provide tools for developers and researchers to detect critical energy hotspots in source code,” explained researcher Rui Rua. The latest artifact developed in this framework is a tool called E-MANAFAwhich helps to monitor and estimate software power consumption on Android devices.

More efficient programming

Programming languages ​​are the backbone of mobile apps, websites, and more. And currently there are hundreds of programming languages ​​available that solve different problems that programmers need to solve. Python, for example, is often used in machine learning and artificial intelligence, and JavaScript for web development, to name a few. The group of researchers put programming languages ​​under the microscope to find those that require more energy to perform similar tasks.

The result is a scientific publication presenting the classification of 27 languages ​​ranging from energy saving to energy consumption (Computer programming science, “Ranking of programming languages ​​by energy efficiency”).

“Developers can use this information to decide which programming language is most appropriate for their target scenario, which can vary based on several constraints, such as battery, time, and memory limitations,” said João Saraiva.

Google’s energy consumption has increased over the past few years, reaching 15.4 terawatt hours in 2020, which would be enough to power 9.6 million European homes in 2019, and it is very likely to continue to increase , not just at Google. s cases, but in most industries. Considering that the world uses more and more energy, it is of the utmost importance to optimize energy.

Although it may not be visible to end users, software energy efficiency must be considered if the world is to tackle climate change, as 80% of the energy produced in the world still comes from fossil fuels.

Automatic debugging

Coding will inevitably lead to bugs, and debugging is, in itself, a way to improve the energy efficiency of software. The group also focuses on software fault isolation (SFL), one of the most expensive and time-consuming activities in program debugging.

“We developed a technique that provides semantic information about the changes that led to a software bug. The tool that implements this technique is publicly available and is called Morpheus,” said INESC TEC researcher Francisco Ribeiro.

In this issue (2021 IEEE 21st International Conference on Software Quality, Reliability and Security, “On understanding the contextual changes of chess”), the authors showed that automated repair techniques can take advantage of this new information and repair programs more efficiently.

But isn’t there a way to debug automatically? That’s what Automated Program Repair (APR) is all about: repairing faulty programs with as little human intervention as possible. In fact, companies like Meta clearly recognize these benefits and are actively researching them. Regarding the APR, the group of Portuguese researchers obtained a repair rate of 27% in their studies with more than 6000 defective programs.

The energy crisis has begun and climate change is imminent. In a growing digital society, being digitally efficient is a must. Whatever the method, it’s good to know that software engineers are doing their part.

Comments are closed.