Green coding - Ryan Mangan: The role of energy efficiency in development

This is a guest post in the ‘green coding’ story series written by Ryan Mangan, FBCS CITP.

Mangan a datacentre and cloud evangelist… and founder of Efficient Ether.

Efficient Ether is a startup on a mission to reshape cloud cost management, XaaS (Everything as a Service) and environmental stewardship for companies of all sizes.

Mangan writes in full below as follows…

Global warming and its environmental impact are phrases we hear often and as the understanding of these issues grow, so does the importance of addressing them. The significance of reducing our carbon footprint has become undeniable and the IT industry is pivoting towards more sustainable practices. Among these, green coding stands out, emphasising the role of energy efficiency throughout the software development lifecycle. It showcases how mindful coding practices can have a substantial impact, demonstrating that even the smallest of adjustments in code can significantly lower an organisation’s environmental footprint.

Choosing coding languages wisely

When it comes to energy consumption, not all programming languages are created equal. Some are inherently designed to be more efficient, executing tasks with minimal resource utilisation. In contrast, others may be more resource-intensive.

Languages like C and Rust are known for their performance efficiency, which results in lower energy consumption, on the other hand, interpreted languages such as Python, though popular, highly versatile and user-friendly, may not be as energy-efficient due to their runtime processing requirements. However, the choice of language also depends on the context of the application, its required performance, scalability and maintainability.

Research, such as the findings presented in the Green Lab’s study by Pereira et al., 2017, is a valuable resource in these discussions. It sheds light on how different programming languages perform in terms of energy consumption, equipping developers with valuable insights and helping them make informed decisions which may have positive or negative impacts on emissions.

Considerations in development processes

But energy-efficient software extends beyond the choice of programming languages.

It [energy-efficient software] also entails a broad range of best practices and considerations that can significantly reduce a program’s energy consumption. One example of optimisation is the transition from individual request processing to batch processing. While batch processing, if not optimised, can potentially escalate CPU and memory usage, effectively managed batch operations can drastically reduce an application’s energy footprint. By aggregating tasks and minimising repetitive overheads associated with individual requests, batch processing can streamline computational workflows, thereby conserving energy. Streamlining code and overall processes can help reduce an application’s energy footprint as well as the overarching performance of the application.

Another consideration involves selecting and managing libraries and plugins; relying on outdated versions can lead to security risks and inefficiencies in runtime performance, adversely affecting the application’s energy consumption.

Refactoring is a typical process; however, not all developers adopt continuous refactoring and optimisation strategies, which support the maintenance of code bases that are both more efficient and energy efficient. As applications evolve, previously efficient code can become outdated or suboptimal. Regular review and refinement of code bases help maintain and improve efficiency.

AI’s impact to green coding

In the context of green IT and green coding, incorporating AI into development raises new considerations, such as balancing the intensive nature of AI-generated outputs alongside the need for resource efficiency.

As mentioned by Strubell et al. (2019), it is important to ensure that AI endeavours adhere to eco-friendly coding standards and contribute to environmental responsibilities. Using techniques like Retrieval-Augmented Generation (RAG) and smart caching strategies offers some promise in optimising AI utilisation, minimising unnecessary computations and delivering more concise and contextually relevant output, reducing the requirement to repeat tasks for validation, which naturally would consume more resources.

Strategic placement

Developers can mitigate environmental impacts and boost energy efficiency by selecting data centres in regions known for their low carbon footprints and commitment to renewable energy, such as parts of Northern America and various European countries.

These regions are notable for their favourable Power Usage Effectiveness (PUE) ratings, indicative of a more sustainable approach to application hosting. While drawing on general industry insights, including those from initiatives like Microsoft’s Azure Cloud (Microsoft Azure Blog, 2022), developers should consider prioritising the placement of resources in data centres that demonstrate efficient energy use. By opting for locations where renewable energy sources are abundant and PUE ratings are impressive, developers should consider aligning their hosting strategies with sustainability objectives, ensuring that their choices support environmental goals.

Closing points

Ryan Mangan, datacentre and cloud evangelist… and founder of Efficient Ether.

The push for energy efficiency in programming is more than a technical / business challenge; it could also be argued as a moral obligation in the face of global environmental concerns. By embracing green coding practices, developers and organisations can make a tangible difference, reducing the IT industry’s carbon footprint and contributing to a more sustainable future.

Adopting efficient programming languages, optimising development processes, considering the impact when using AI, making strategic hosting choices and committing to continuous code refinement are all positive steps. These practices foster sustainability and promote the creation of more robust, reliable and maintainable software, illustrating that green coding is good for the planet and business.

References

Pereira, R., Couto, M., Ribeiro, F., Rua, R., Cunha, J., Fernandes, J. P., & Saraiva, J. (Year). Energy Efficiency across Programming Languages.

Strubell, E., Ganesh, A., & McCallum, A. (2019). Energy and Policy Considerations for Deep Learning in NLP. arXiv:1906.02243.

Microsoft Azure Blog. (2022). How Microsoft measures datacenter water and energy use to improve Azure Cloud sustainability. Microsoft Azure.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

CIO
Security
Networking
Data Center
Data Management
Close