7. Develop efficient software
Greener software generally means efficient applications that use less energy on servers, supporting infrastructure and end-user devices.
Further Reading
10 Recommendations for Green Software Development, Green Software Foundation
Key Disciplines
Development
7a. Create greener code
Adopt a range of strategies to reduce software’s processing requirements, including choosing programming languages that are energy efficient and keep code clean and simple.
Lifecycle phases
Actions
There are a range of actions that could potentially be taken to support this guideline. For more detailed guidance see the 'more detailed guidance' box below.
(i) Choose greener coding languages where possible
Different programming languages run at different speeds, with significant implications for energy use.
NB: There may be a tradeoff between the ‘greenness’ of code and team productivity
We need to factor in levels of skill/familiarity of programmers with particular languages, and so dev time, effort and maintenance into decision making about which coding languages are used.
'You might get a hundredfold reduction in carbon emissions by switching, for example, from Python to a much more efficient language like Rust, but there will be a price to pay in productivity. Developers really do deliver much more quickly when they are using lower machine-efficiency languages like Python. As a result, writing efficient code is unattractive to businesses, who want to devote their developer time to building new features, not writing more streamlined code.'
Currie, Anne; Hsu, Sarah; Bergman, Sara. Building Green Software (pp. 24-25). O'Reilly Media. Kindle Edition.
(ii) Optimise caching for energy efficiency
Develop a caching strategy for the specific application context and usage scenario as that can lead to significant energy efficiencies. Make use of public and shared caches, for example with the GOV.UK assets.
(iii) Only load resources and components when they are actually used
Loading unused components means needless data transfer to user device.
(iv) Choose static over dynamic pages where possible
A flat HTML file is fast to serve and uses considerably less energy compared to webpages that are generated dynamically.
(v) Consider benefits of server-side rendering vs client- side rendering for energy efficiency.
More detailed guidance on greener software development
There are a variety of publicly available guidelines that describe patterns and techniques that can be used to help implement thise guideline.
Green Software Foundation Patterns
The Green Software Foundation have developed a well-researched and regularly updated set of patterns and techniques to reduce the environmental impacts of digital services. These are broken down by 'web' and 'cloud'.
W3C Web Sustainability Guidelines
The W3C's draft Web Sustainability Guidelines include comprehensive recommendations for reducing the environmental impacts of websites and digital products. Guidance comes under the following categories: user experience design, web development, hosting and infrastructure and business and product management considerations.
Handbook of Sustainable Design of Digital Services
The Handbook of Sustainable Design of Digital Services, known as GR491, was created in France by the 'Institute for Sustainable IT'. It covers a range of recommendations for delivering digital services with reduced environmental footprints.
Measurement
The Software Carbon Intensity (SCI) methodology has been developed to allow calculation of the rate of carbon emissions of a software system. Encompassing energy consumption, resource utilization, and the emissions generated throughout the whole software lifecycle, the SCI generates a score, which is designed to ‘help software practitioners make better, evidence-based decisions during system design, development, and deployment, that will ultimately minimize carbon emissions.’
The SCI and has now become an International Organisation for Standardisation (ISO) standard.