At first glance, sustainability and the efficiency of technologies are inextricably linked. After all, increasing efficiency can save resources and electricity and thus reduce environmental impact. Following this narrative, a study that examines the energy efficiency of programming languages is often cited in the context of digital sustainability. But are efficient programming languages really more sustainable?
What is efficient programming languages all about?
The paper “ Energy efficiency across programming languages ” by Pereira et al. (2017) attempts to provide an answer to this question. It examines programming languages for speed, energy consumption and memory usage, i.e. the utilization of the main memory (RAM). To do this, toy programs from the Computer Language Benchmarks Game are executed and measured at runtime.
The results are not surprising. The paper states: "It is well known that the top three languages (C, C++ and Rust) are highly optimized and efficient in execution, as our data shows." The full ranking can be seen france consumer email list in the figure below.
Test bench of the results from three test scenarios, source: Pereira, R., Couto, M., Ribeiro, F., Rua, R., Cunha, J., Fernandes, JP, Saraiva, J. (2017): Energy efficiency across programming languages: how do energy, time, and memory relate?
Is runtime energy efficiency a useful metric?
First, the obvious finding, which the authors themselves repeatedly emphasize: There is no linear relationship between execution time and energy consumption. Code that is executed twice as fast does not always use half as much energy. The answer to one of the research questions, "Is the faster language always the most energy efficient?" is therefore clear: "No, a faster language is not always the most energy efficient." In an interview with one of the authors, the results are put into context once again.
The authors of the toy programs used also write: "We are deeply uninterested in the claim that the measurements of a few small programs define the relative performance of programming languages ." This refers to the fact that the programs are not comparable with software used in production, often have completely different requirement profiles and the results are therefore not transferable. There are important characteristics of languages that are not sufficiently taken into account in such a test. Running algorithms is one thing, but applying them in complex, distributed systems with lots of data transfers, asynchronous processes and access to long-term memory is something completely different.
Sustainability of programming languages: Java rather than TypeScript?
-
- Posts: 55
- Joined: Sat Dec 21, 2024 6:27 am