BACK TO THE BLOG

GreenCoding: More efficient software reduces CO2 emissions

Many experts agree that digitalisation helps reduce CO2 emissions. But things are not quite that simple, as the coding and use of software itself contribute significantly to greenhouse gas emissions. The GreenCoding concept shows what developers and operators need to watch out for.

Climate change is one of the main challenges of the 21st century – governments, investors and courts are all demanding increased efforts to reduce emissions. The only aspect still disputed is which measures we need to take to reduce CO2 emissions. Digitalisation plays a key role in these considerations as it helps make travel superfluous, production processes more efficient and decisions more intelligent. What we sometimes forget though is that IT itself also generates emissions. Information and communication technology currently accounts for 5 to 9 percent of global electricity consumption. However, due to the pace of digitalisation, Enerdata expects this figure to reach 21 per cent by 2030. And because only 11 percent of global energy production comes from renewable sources (as of 2019), ICT technology is already a significant contributor to CO2 emissions with a rising share of all pollution.

Such abstract figures hardly reflect the dimensions involved. Experts estimate that a Google search releases about 0.2 grams of CO2. If you wanted to offset the emissions caused by every search made in a single year, you would have to plant about 40 million trees – assuming each tree converted about 10 kilograms of CO2 into biomass per year and an estimated 5.6 billion search queries annually. But even this pales in comparison to the 2.2 billion trees that would need to be planted for the 22 million tonnes of CO2 emitted each year by bitcoin mining. And a third example also illustrates this scale effect: if you work on your laptop for just an hour a day, you would have to plant one tree every year. Assuming eight hours a day and scaled to many million office workers, this quickly adds up to a hefty total.

What to do?

Given these figures, sitting back and hoping that electricity producers will speed up their switch to renewable sources is not an option. Instead, IT and software need to reduce their own emissions. The term ‘Green IT’ is probably familiar to most of us. The idea is to reduce IT energy consumption primarily through more efficient hardware, for example by making the operation of data centres less power-hungry. What is new, however, is the concept of ‘GreenCoding’. The term summarises a variety of measures aimed at the development of low-emission and more sustainable software.

The principles behind GreenCoding may sound familiar to anyone already heavily involved with computers in the 1980s. Back then, programmers faced limitations such as tiny RAM and ROM capacities, sluggish processors and laughable transmission bandwidths by today’s standards. They had to fight for every bit. “In the Eighties, programmers were already working much the same way as GreenCoding calls for today,” recalls Marika Lulay, CEO of the software company GFT. It’s just that these restrictions later disappeared as memory and computing power became plentiful, and priorities shifted.

Old principles – rediscovered

Recently, people have been returning to these principles – albeit for different reasons: namely to reduceCO2 emissions. There are plenty of possibilities, as these examples show:

▪️ Compressing the content of one HTML web page from 200 kB to 20 kB would reduce transmission volume to about a tenth. If the page was visited by one million users per year, this would save ten kilograms of CO2– an amount which requires the planting of one tree to offset.

▪️ Speeding up the launch time of an app accessed a million times a day by one second would save 132 kilograms of CO2 annually.

▪️ One application that is likely to become more common in future is the training of artificial intelligence neural networks. Training the AI networkGPT-3, which caused a sensation when it composed amazingly ‘human’-sounding texts, generated 85 tons of CO2 – as much as a car would generate if it drove to the Moon and back. Together with experts from Google, scientists at the University of Berkeley have developed processes that reduce energy consumption by99.9 per cent when training such networks.

▪️ Using ‘dark mode’ on OLED or Micro LED displays can save a massive 550,000 tons of CO2 – assuming about one billion smartphones worldwide with such displays consistently used dark mode.

Despite all this, optimising software for energy efficiency is still in its infancy. One reason could be the difficulty of correctly quantifying the emissions of software. Software providers typically only calculate Scope 1 and Scope 2 emissions. Scope 1 are the emissions from the direct combustion of fossil fuels in the production of a good. Scope 2 are indirect emissions that occur during production, for example through the purchase of electricity. Scope 3 comprises all emissions that occur in the supply chain, for example during the mining of raw materials, as well as during subsequent operation at the customer’s premises or during disposal. Such Scope 3 emissions also occur with software, as the example of Microsoft shows: 75 per cent of all the company’s emissions are Scope 3, i.e. the production and distribution as well as the use of Windows, Office or cloud products on our PCs in the office or at home.

Companies will have to address these emissions in future. Firstly, because statutory regulations are becoming increasingly strict – the EU’s Green Deal is only one cause. And secondly, because investors such as Blackrock, the world’s largest asset manager, are exerting increasing pressure on companies to disclose their ESG score, for example. Tim Schade, IT architect and GreenCoding expert at GFT, is therefore certain that the market will soon be demanding GreenCoding. “There’s a lot of interest. Some very high-profile companies have already approached us and asked us to give presentations on GreenCoding.”

One hurdle for GreenCoding is that there are still no de facto standards for identifying suitable measures. Those seeking to create sustainable software(GreenCoding) or make existing software more sustainable in retrospect(GreenRefactoring) should start where they see the greatest potential for optimisation. It would be useful to have a solution for the precise measurement of power consumption or CO2 emissions of individual measures, decisions or even lines of code. However, this can be complex, time-consuming and error-prone.

GFT is currently working on a qualitative assessment. This can bethought of as a checklist that weights individual measures according to their effect and gives users feedback on where there is still untapped potential, or whether they are already implementing GreenCoding to a large extent. In future, these assessments will be linked to measurements of actual consumption and the savings achieved by various measures. This is because actual consumption also depends on the devices used, the usage habits of the users and the hardware of the operators.

In webinars for his colleagues, Tim Schade teaches the basic principles of GreenCoding. Over 400 GFT employees have already participated and been awarded certificates. The measures can be divided into four areas: architecture, logic, methodology and platforms. There are numerous tips, rules and guidelines for each of these areas. Below are just a few:


Tips for software developers


Green architecture

▪️ Shutdown when idle
When nobody is in the room, you turn off the lights – this should also apply to software. It needs to be designed according to modular principles, so that modules and microservices are shut down when demand is low.  

▪️ Avoid impulsive consumption
Software usually operates in real time: jobs are processed immediately. However, this is not always necessary. Certain tasks such as housekeeping, video transcoding or data backups can be postponed in some cases. This allows tasks to be batched and executed when there is enough green energy available. It also makes better use of the hardware.

Green logic

▪️ Zero-waste code
90 per cent of software today contains open source code developed by third parties. Sometimes this is a perfect fit for the problem, but often it contains redundant sections that cause artefacts to grow, slowing down the creation, deployment and startup of applications. So-called tree-shaking engines can detect and remove “dead” code.

▪️ Low-foot print resources
Some file formats use fewer resources than others. CSV needs less than Excel, YAML less than XML. Research by GFT shows that the choice of API can also have a direct impact on greenhouse gas emissions. Likewise, images offer huge savings potential – they should always be compressed to reduce the amount of data transmitted over the network.

Green methodology

▪️ Use agile development
Agile and lean methods make it easier to adapt software for efficiency. Development in small steps helps reduce feedback loops. Developers then only compile and test the modified sections of code, not entire projects.

▪️ Avoid long loading times
The loading and launching time of software is easy to measure and directly correlates with its energy consumption. For developers, this is a good way to assess the impact of code changes.  

Green platform

▪️ Optimal hardware utilisation
Servers that are not fully utilised consume more energy than they should. This happens when systems are oversized. Cloud computing can offer significant energy savings as public cloud systems are highly modular and allow for precise workload management. AWS, Google Cloud and Microsoft Azure, for example, run at around 65 per cent utilisation, whereas on-site data centres only achieve 12 to 18 per cent.

Emission-free by 2025


One final observation: GreenCoding is still in its infancy, and only few software providers and users are actively addressing the issue. This is precisely why GFT has set itself the goal of driving the topic forward and is working with partners to achieve a common understanding which may one day lead to a GreenCoding certification. GFT is also undertaking considerable efforts within the company to reduce its emissions. For example, the company has announced that it wants to achieve net zero emissions by 2025. This means reducing emissions wherever possible and offsetting the remaining emissions.  

Find more information on GreenCoding here.  

Download the whitepaper on GreenCoding