Programming languages and the environment

Published: 07.04.2022

Something often overlooked by most people, software developers included, is the energy spent to develop software solutions. By energy, we will not consider the used coffee beans or the dislike towards the language (hey PHP).

What will be considered is the runtime, memory usage, and pure energy consumption as far as electricity goes, as described and examined in an excellent paper called “Energy Efficiency across Programming Languages.” Truly a paper in line with the times considering climate change the need for more energy, especially clean energy.

We will also insert here the link to the relevant repo as well as a page with results

Let us also look at the history of software development (or, better said, the history of computer systems without which no software development would be possible). In its infancy, a significant concern was a memory. For example, the 1969 Apollo 11 mission guidance computer had 4KB of RAM with a 32KB hard disk. Today, in large part, that problem is solved for some but not all needs.

Increase of capacity for memory components in the last 3 decades - Infographic

Image 1. Increase of capacity for memory components (in number of transistors) in the last 3 decades

Technological improvements, more efficient use of existing technologies, and advances in communication between hardware and software elements made this growth possible.

Today’s primary concern is speed. We want to do more in less time. More transistors can mean more processing power if supported by a sophisticated architecture that can take advantage of this. There are billions or even trillions of transistors on today’s systems. Performance is most often looked at in terms of speed, while other factors are left outside consideration.

Now that we know a little about history, let us check out the results of the mentioned paper and how it is relevant today. Power consumption is becoming a major issue, embedded systems and mobile phone apps are prime targets for optimization. Profit for crypto mining is also heavily dependent on how much energy is consumed. We even have examples where our battery technology is lacking compared to what is needed today.

The researchers in the paper had to use a benchmark for their tests. They’ve used the Computer Language Benchmarks Game method on 27 languages.

CLBG Corpus of programs - Infographic

Image 2. CLBG Corpus of programs

Languages sorted by paradigm - Infographic

Image 3. Languages sorted by paradigm

The results showed that compiled languages are the fastest and most energy-efficient. C and C++ proved the best, while Go didn’t compare that well.

The study tests were performed on a machine based on an Intel Core i5-4460 Haswell CPU @ 3.20GHz with 16GB of RAM, and running Ubuntu Server 16.10 operating system with Linux 4.8.0-22.

Language comparison - Infographic

Image 4. Language comparison

Normalized global results for energy, time and memory - Infographic

Image 5. Normalized global results for energy, time and memory

C, C+, Rust and Java are the most efficient languages, even though Java eats up memory. An essential thing to note is that faster does not mean greener and less power used (it does help in some).


  • Pereira, R., Couto, M., Ribeiro, F., Rua, R., Cunha, J., Fernandes, J.P. and Saraiva, J. (2017). Energy efficiency across programming languages: how do energy, time, and memory relate? Proceedings of the 10th ACM SIGPLAN International Conference on Software Language Engineering - SLE 2017.
  • OSNOVE RAČUNARSKIH ARHITEKTURA, prof. Novica Nosović, prof. Željko Jurić

Let's work together

You made it this far! Thank you for reading this article. We hope you found it useful. Please feel free to share it with your peers if you feel like supporting us.

Work with us See Ankora Software Profile