So how can you be a good citizen and save the planet? The answer lies in a research paper published from Portugal. In the paper, they examine the energy efficiency of twenty-five different programming languages and try to determine the most energy efficient language. They use the Computer Language Benchmarks Game to develop a consistent testing environment for each of the languages. For each trial, they measure the energy output (in joules) from the CPU and DRAM, execution time and memory usage.
Most Energy Efficient Language
Just as a quick refresh, recall the areas that each programming language belongs to:
After performing a couple of trials, the researchers were able to rank the languages in terms of energy efficiency
It should come as no surprise that their findings revealed that compiled languages had faster execution time and a lower memory footprint than interpreted languages. Remember, interpreted languages have no compile stage. The conversion to byte-code happens at runtime for the language.
Most people would agree that total energy is the product of time and power. Assuming power is constant, decreasing execution time would lead to a decrease the total energy used by the program. The researchers found that this was not always the case. For example, Fortran used less energy than C in a particular benchmark but its execution time was a whole lot longer.
This anomaly reveals that power isn’t a constant value. Perhaps the way a compiler is implemented could give it a power advantage with certain system calls.