google-site-verification=Ubk8EASPk7ApOx0IU8pZEKwm82jQuCOwDJVO2zCqDqo
top of page
Search

Tips For Greener Software

  • Sean Massey
  • Jan 13, 2022
  • 2 min read

I've come across a great (and accessible) research paper for coders to look at how they can measure the impact of their software and how to reduce its impact on the planet.


Understanding Green Software Development: A Conceptual Framework by Luca Ardito, Giuseppe Procaccianti, Marco Torchiano, Antonio Vetr`o can be found at https://www.researchgate.net/publication/272148058_Understanding_Green_Software_Development_A_Conceptual_Framework


They offer these tips for Greener Code....

  • Clean up useless code and data :: As software evolves, many parts may become obsolete. Writing to never-read variables and other useless routines (e.g., repeated conditionals) may consume power purposelessly. Cleaning up these instructions might improve energy efficiency, as well as maintainability. Many static analysis tools are able to detect useless code.

  • Look for Immortals :: The life cycle of software processes and threads must be carefully managed. The Immortality Energy Smells describes situations where a software service restarts after explicitly being killed by the user, continuing to drain energy. Sometimes, software immortals are created on purpose: in this cases, death and rebirth phases of the processes/threads should be as graceful as possible, in order to reduce the resource usage overhead and the consequent energy waste.

  • Monitor the appropriate resources :: The physical responsible of energy usage is hardware. That being said, in modern computer systems there are many different hardware devices, with different power requirements. Understand first which hardware needs more energy (e.g., GPS transmitter, wireless antennas, sensors), then which software routines make use of it.

  • Scenario driven refactoring :: The software execution depends not only on its internal structure and host environment (e.g., operating system), but also on the input it receives. Thus, an energy refactoring operation may show its results only in specific situations. Focusing on common usage scenarios makes the improvements more perceivable by the end users and saves eventually more energy.

  • Focus on higher-level structures and complex routines :: Like in performance optimization problems, improvements obtained at lower level might be hidden from higher level inefficiencies. This is especially true when there are many software layers or when software runs in a complex environment (e.g., virtualization, distributed systems). Start refactoring from higher level constructs: their impact on CPU and memory (and consequently, energy) is significantly higher compared to basic data types.

  • Do not trust loops :: Loop constructs are powerful, but their contents must be carefully monitored. Loop smells happen when an application repeats the same activity on a loop, without achieving the intended results and uselessly consuming energy (e.g., polling an unreachable server). Detecting and refactoring such loops can save lot of energy, especially on battery powered devices.

  • Reduce amount of data transferred :: In distributed and high-performance systems, or in battery powered devices using power-consuming radio transmission, data transfer might be a significant source of power drain. Data exchanged between software applications and/or databases (local or remote) can be optimized using data compression or data aggregation techniques. The energy impact of this optimization might be crucial, in data-intensive and Big Data applications.



 
 
 

Comments


bottom of page