By Benjamin Terrier, Backend Engineer
As the importance of energy efficiency in technology continues to grow, the energy efficiency of programming languages and social networks has become a topic of increasing interest. In recent years, a widely circulated table comparing the energy efficiency of various programming languages and social networks has sparked discussion and analysis among both technical and non-technical audiences. In this article, we will delve into the implications of this table and how it was shared on social networks.
This table is an extract from a 2017 scientific article, Energy Efficiency Across Programming Languages, and it makes sense: compiled languages like C or C++ are fast and energy efficient while interpreted languages like Python are slow and inefficient. Because of this many people used this data to make and support claims such as “Java is 89% slower than C”.
So, I decided to investigate and reproduce the measurement of the original
paper. Because of limited time and resources to focus on a selection of 9
programming languages, I used a computer like the one used in the study.
Having my own baseline, I then decided to update the source code used for the benchmarks. The original article used the top solutions from The Computer Language Benchmark Game, but since 2017 new faster solutions were added. Using the new fastest solutions as of 2022 and keeping the 2017 C scores as a reference, I got the following results:
The main takeaway is that there’s a clear link between the number of new solutions and the improvement made by a language in the past 5 years. And it is not very surprising: C, C++, and Rust are popular and have had many new solutions. Ada is not popular and got 0 new solutions. Python is popular, but Python developers are probably not the most interested in this kind of benchmark.
To conclude, I compared my 2022 results to the 2017 results:
In conclusion, while the table comparing the energy efficiency of programming languages has gained widespread attention, it is important to recognize that the methodology used to generate these results is not precise enough to make definitive statements such as “Java is 89% slower than C.”
The results are heavily influenced by the popularity of languages and cultural factors surrounding each language, as well as the specific programs that were chosen for benchmarking at a given time. While the table can give a general sense of the relative performance of different languages, it should not be relied upon for definitive conclusions.
It is always important to approach information found on the internet with skepticism and to carefully consider the context in which it is presented.