April 24, 2025
Trending News

Electricity is so expensive that it’s a good idea to find out which programming language is the most efficient.

  • September 25, 2022
  • 0

Trying to be more efficient with the price of electricity from the roof is a common goal in every field. We look for any kind of plan B

Electricity is so expensive that it’s a good idea to find out which programming language is the most efficient.

Trying to be more efficient with the price of electricity from the roof is a common goal in every field. We look for any kind of plan B to minimize dependencies and extra consumption. And one area where it is possible to set this goal is software development. How to program more efficiently?

Which programming language consumes less electricity? A 2017 study by Portuguese researchers has already tried to answer this question. In their analysis—the code used is available on GitHub—they took into account both memory usage and the energy consumed in executing a specific set of programs.

Consumption measurement. This group of programs is called the Computer Language Comparison Game and is a Free Software project that allows you to compare how certain algorithms are implemented in various programming languages. In this process, execution time, memory consumption or CPU usage are analyzed.

27 opposite languages. Different programming languages ​​belonging to different paradigms were compared in the analysis: functional, imperative, object-oriented and script. It was here, from classic languages ​​like C or C++ to more modern alternatives like Rust, as well as well-known ones like Javascript, Perl, PHP or Python.

Screenshot at 2022 09 21 11 43 16

Source: Minho University.

C, Rust and C++ win separately. When examining power consumption, execution time, and memory consumed, the normalized data shows C, Rust, and C++ as the winners. Among the worst behaved were Python, Perl, Ruby, Lua or PHP. There’s also the question: very old languages ​​like Pascal or Fortran don’t consume much, but their low memory usage is noticeable because they were probably designed when that resource was particularly limited. In general, compiled languages ​​seem to be more efficient than interpreted languages.

Screenshot at 2022 09 21 11 49 22

let’s do couples. Although this is the general classification, the researchers also wanted to provide options for those wishing to solve compound productivity problems. Thus, they identified the best languages ​​to save energy from execution time and memory (C, Pascal and Gowin), energy and time (C, Rust and C++), energy and memory (C and Pascal), or three purposes. time and memory (C, Pascal and Go stand out).

A flawed work. The study has already sparked controversy on social media. like twitter, and in the comments on Hacker News several developers noted that the code is not ideal for comparison. So one user explained that this code “doesn’t reflect how languages ​​like Python behave in practice”, but that’s not really the question.

Efficiency is not a priority. As another user explained, if you really want to be efficient, the ideal would be to program in assembler. While it’s interesting to know which language is more efficient, it’s even more important to make it clear that some programming languages ​​are great for some things while others are great for others. In fact, what is clear in this area is that the most popular programming languages ​​are not the most popular – Rust, for example, is the most fashionable – nor are they the most money-making languages.

Image | james harrison

Source: Xataka

Leave a Reply

Your email address will not be published. Required fields are marked *