Fundamentals 6 min read

Benchmarking 27 Programming Languages: Speed, Energy Consumption, and Memory Usage

A recent study benchmarked 27 programming languages using the Computer Language Benchmarks Game and Rosetta Code, measuring execution time, energy consumption via Intel RAPL, and memory usage, revealing that compiled languages like C and Rust dominate performance while interpreted languages lag behind.

IT Services Circle
IT Services Circle
IT Services Circle
Benchmarking 27 Programming Languages: Speed, Energy Consumption, and Memory Usage

A recent research project from Portugal evaluated 27 programming languages with a comprehensive benchmark suite, combining the classic "Computer Language Benchmarks Game" and a Rosetta Code test set, to measure three key metrics: execution speed, energy consumption (using Intel's RAPL interface), and memory usage.

The experimental framework repeatedly runs each language's implementation of a task, records the start and end timestamps, and captures power data via RAPL. A simplified version of the test loop looks like this:

for (i = 0; i < N; i++) {
    time_before = getTime(...);
    rapl_before(...);
    // use system call to execute program
    // e.g., system("/usr/bin/python binarytrees.py")
    system(command);
    rapl_after(...);
    time_elapsed = getTime(...) - time_before;
    ...
}

Results from the first benchmark set show that, unsurprisingly, C is the fastest language (used as the baseline), with Python running about 71.9 times slower and consuming roughly 75.9 times more energy. Lua is the slowest, while compiled languages such as Rust, C++, and Ada also rank near the top for both speed and energy efficiency.

Memory‑usage measurements reveal an unexpected leader: Pascal occupies the least memory, pushing C down to third place.

To verify the findings, the authors repeated the experiments with nine tasks from Rosetta Code, which emphasizes code readability over raw performance. The second round produced similar rankings: C, Pascal, Ada, Rust, and C++ remain at the top, while Ruby, Perl, and Python stay near the bottom. Java’s position dropped significantly because the Rosetta Code implementations relied heavily on collections rather than static arrays.

The study highlights that while compiled languages generally deliver superior performance and lower energy consumption, real‑world software development must also consider factors such as development speed, maintainability, and ecosystem support. For system‑level or performance‑critical applications, C, C++, and Rust are recommended; for rapid application development, higher‑level languages like Python, Java, JavaScript, or Ruby may be more appropriate.

Original research paper: https://haslab.github.io/SAFER/scp21.pdf

PerformanceBenchmarkprogramming languagesC languageMemory usageenergy consumption
IT Services Circle
Written by

IT Services Circle

Delivering cutting-edge internet insights and practical learning resources. We're a passionate and principled IT media platform.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.