What are the Greenest Programing Languages?๐ฉ๐ปโ๐ป
The Answers may surprise you.
Hey Guys,
Itโs been a while since Iโve seen this topic covered. As a fan of both ESG and Green Technology and programming languages I was curious. So I looked it up.
Tl;dr here are the results:
I somewhat suspected C and Rust would be near the top here. This is based on a 2021, the original study was in 2017.
Top Green Programming Languages
C
Rust
Java
Swift
Haskell
C#
Go
Dart
JavaScript
TypeScript
โThis paper presents a study of the runtime, memory usage, and energy consumption of twenty-seven well-known software languages. We monitor the performance of such languages using ten different programming problems, expressed in each of the languages. Our results show interesting findings, such as slower/faster languages consuming less/more energy, and how memory usage influences energy consumption. We show how to use our results to provide software engineers support to decide which language to use when energy efficiency is a concern.โ
This study implemented 10 benchmark problems in 27 different programming languages and measure execution time, energy consumption, and peak memory use.
๐ ๐ถ๐ ๐๐ต๐ฒ ๐บ๐ผ๐๐ ๐ฒ๐ณ๐ณ๐ถ๐ฐ๐ถ๐ฒ๐ป๐ ๐ฝ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ด ๐น๐ฎ๐ป๐ด๐๐ฎ๐ด๐ฒ, ๐๐ต๐ถ๐น๐ฒ ๐ฃ๐๐๐ต๐ผ๐ป ๐ฎ๐ป๐ฑ ๐ฃ๐ฒ๐ฟ๐น ๐ฎ๐ฟ๐ฒ ๐๐ต๐ฒ ๐น๐ฒ๐ฎ๐๐ ๐ฒ๐ป๐๐ถ๐ฟ๐ผ๐ป๐บ๐ฒ๐ป๐๐ฎ๐น ๐ณ๐ฟ๐ถ๐ฒ๐ป๐ฑ๐น๐ ๐ฝ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ด ๐น๐ฎ๐ป๐ด๐๐ฎ๐ด๐ฒ๐.
Full text: https://medium.com/codex/what-are-the-greenest-programming-languages-e738774b1957.
The original report with updated info: https://sites.google.com/view/energy-efficiency-languages/.
Post credit: I saw it on Dr. Milan Milanoviฤโs account.
๐ A very common misconception when analyzing energy consumption in software is that it will behave in the same way execution time does. In other words, reducing the execution time of a program would bring about the same amount of energy reduction. However power doesnโt follow this rule.
The Computer Language Benchmarks Game
The CLBG initiative includes a framework for running, testing and comparing implemented coherent solutions for a set of well-known, diverse programming problems.
You can see the complete results here.
I think in some ways the paper is very theoretical and novel and may not fully be totally representative of the challenge of the question, but is pretty amusing at least. I wonder a few years later if this would have changed using the same methodology. As new languages are rolled out like Carbon I wonder if they take this into consideration:
In Case you Missed It
The study is now about five years old:
The paper was popularized by the Rust people from AWS, and many software engineers donโt take it entirely seriously. However itโs highly shareable and stirs up some useful debate.
You can read a 2021 update to this question here.
There are many variables the study did not take into account according to commentators:
Skill of the engineers themselves.
Debugging energy
Lifecycle energy cost
Impact of JIT compilers of many languages
Still the article is a rare example of asking an important and tough question and trying to find the most relevant benchmarks.
Join 33 other paying subscribers for additional content and locked archive posts.