language-bench

File processing

Stream a 49 MB CSV and aggregate it.

io-boundstringsdata-structures

What is measured

Before each iteration a fresh ~49 MB CSV file (id,word,value; 1,900,000 lines, a Zipf-like word distribution) is written to tmpfs, so the timed part measures reading and aggregating from memory, not disk speed. It streams the file once and returns the number of lines, the sum of the values, the number of distinct words and the most frequent word with its count.

Pseudocode

path = decode(instance)               # generator wrote a new file to tmpfs, untimed
start timer
for each line in file:
    split into id, word, value
    lines += 1; sum += value; counts[word] += 1
top = word with max count (ties: smallest word)
stop timer
delete the file

Reveals: End-to-end I/O, buffering and per-line overhead.

Caveat: Results depend on page cache, filesystem, storage and buffering. The file is generated once before the measurements and sits in the page cache, so this is mostly a CPU/parse test, not disk speed.

Results (newest release of each language)

Language / buildTime (× vs best)
C 16 · gcc -O3 -march=nativedefault146 ms (1.01×)
C 16 · gcc -O2147 ms (1.01×)
C 16 · gcc -O3147 ms (1.01×)
Go 1.27 · GOAMD64=v3 go build177 ms (1.22×)
Go 1.27 · go builddefault181 ms (1.25×)
Python 3.15 · python3default913 ms (6.31×)

Click a language to see the source code, build flags, every session and how the number was computed.