iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
📝

Running the Languages Benchmark on Docker

に公開
2025/10/28

Introduction

Around November 2024, I often came across the following benchmark results comparing languages with 1B loops:

https://www.linkedin.com/posts/benjamin-dicken-78797a73_more-languages-more-insights-a-few-interesting-activity-7266839380596547584-RQvT

Although I am not the author, the source code is published below:

https://github.com/bddicken/languages

This time, I borrowed that source code and actually ran the benchmark in Docker. Below are the repository for running in Docker and the actual script.

https://github.com/marudedameo2019/languages_benchmark_docker

https://github.com/marudedameo2019/languages_benchmark_docker/blob/main/run_bench.sh

Purpose

To make the benchmark from the video introduced in the introduction runnable in Docker for anyone.

Background

The video from the introduction was an HTML page viewable at the following URL:

https://benjdd.com/languages

(Note: As of September 4, 2025, the certificate for this domain has expired and cannot be viewed.)

The topic originated from the following Hacker News article:

https://news.ycombinator.com/item?id=42248315

As far as I can tell, it's not a very good benchmark, but the video above, with its distinctive presentation, occasionally appeared even in Japan. Upon investigation, the benchmark code did not mention anything about language development environments, and the environment was unclear, so I set up Docker to install them on Linux and make the benchmark runnable for anyone. However, I cannot output figures like the one in the introduction video.

Benchmark Overview

Original Benchmark

This is an overview of the code that I did not create.

The code from the time the Hacker News article was published now seems to be treated as legacy code and is not normally run. At that time, the code called the benchmark program for each language using a command called hyperfine, and measured and aggregated results. Now, instead, for 1B loops, only the 1B loop part is measured and aggregated on the program side without using hyperfine, eliminating differences due to interpreter/runtime footprint. However, because the code is significantly different, the number of supported languages is now much smaller compared to the legacy code.

The benchmark contents are as follows:

Name Description
loops Loops 100M (current) or 1B (legacy), calculating modulo and sum, storing in array
fibonacci Recursively implemented Fibonacci. Default up to 40
levenshtein Brute-force calculation of Levenshtein distance for 88 strings

Functionally, whereas the legacy code repeated a fixed number of times for measurement, the current code loops until a predetermined time is exceeded. Also, both legacy and current code discard the results of the first predetermined number of iterations.

For details, follow the repository code.

https://github.com/bddicken/languages

Docker Version

This is an overview of the version I prepared. The benchmark itself uses the code above (though the legacy side has necessary patches for the mechanism…).

In the Docker version, both the current code of the original benchmark (as 'current') and the legacy code (as 'legacy') can be executed. However, there are quite a few languages that work in the original benchmark but not here. Roughly speaking, this is mainly because I have not installed languages that are only in the AUR on Arch Linux or not even in the AUR.

The original benchmark has a separate repository that converts CSV data etc. into HTML and returns it from a server, but the Docker version uses plotly to generate simple HTML charts. I run the Docker version scripts with GitHub Workflows and put the results in examples.

Note that the Docker image is about 8GB, and running the script (with all specified) takes about 2 hours even on GitHub Actions.

For details, follow the repository code.

https://github.com/marudedameo2019/languages_benchmark_docker

Measurement Results

The results of the original benchmark are:

  • CSV for current
  • Unformatted text for legacy

It seems there was no HTML generation code for the video in the introduction. As mentioned above, for current, another person seems to have published a web application. Therefore, in the Docker version, I have created my own HTML generation.

The following graphs are from the Docker version's HTML; the vertical axis shows the speed of each language relative to C as 100 (higher values indicate faster speed).

GitHub Workflows (Actions)


CPU: AMD EPYC 7763 64-Core Processor

Results from My Home Environment


CPU: AMD Ryzen 5 1400 Quad-Core Processor
(Fossil PC)

Summary

A foundation has been created to roughly run a relatively well-known benchmark in any environment.

GitHubで編集を提案

Discussion