C programming is the greenest choice

In the virtual world, hardware may feel abstract, nonetheless software still depends on physical infrastructure consuming resources where waste can take place.

Let’s look at datacenters, where the physical location is based on the price of electricity, then you have to keep them cool, placing data center underwater is one solution being explored.

There is also the high energy consumption of crypto mining but let’s focus on a simpler example, that app on your phone that consumes a lot of battery or memory with no apparent reason which ends up being removed by the annoyed user.

As technology evolves, the restrictions due to limitation in the beginning of computers has become kind of less important, no need to be cautious about the Kilobytes of memory when you have Terabytes available to fill…

Choosing the right tool for a project can be challenging. How do you find the most efficient way for the task ? Use a hammer for a nail and screwdriver for a screw, right ?

The same analogy can be made for programming language. Many parameters are to be taken into account such as performance, memory consumption, cost and time to name a few; and there are not many clear ways to know the real difference.

To help to get some objective metrics with the plethora of tech available in our era, a group of Portuguese university researchers wrote a detailed paper comparing 27 programming languages. 10 standard algorithms were used in each language as the primary material for the evaluation. 1

Abstract

"This paper presents a study of the runtime, memory usage, and energy consumption of twenty-seven software languages. We monitored 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."

Data is available including setups,benchmarks and results, nice touch !

C was a clear winner in these tests !

The language gives absolute control, runs blazingly fast (when care is applied), is relatively simple (syntactically speaking), and energy-efficient, you guessed it, it was C, and these are the many reasons why this is our preferred programming language at Intersec.


  1. Note: It is just one small aspect of viewing/measuring the software, not a complete study.

Author Avatar

Camel Zerrouqi