Benchmarks

Native Pelago against C (gcc -O2) and Rust (rustc -O) on 41 small programs, measured on 2026-11-07. Across the 38 programs that run long enough to time, Pelago's geometric mean is 1.02× of C's time and 0.94× of Rust's. It is at or below C on 17 of them, at or below Rust on 21, and at or below both on 11. Shorter bars are faster.

programseconds, median of at least 5 Pelago C -O2 Rust -Ovs C -O2vs Rust
base640.0250.0210.0431.19×0.58×
bintrees0.0290.0140.0262.07×1.12×
blur0.0100.00770.0111.30×0.91×
collatz0.0390.0430.0250.91×1.56×
crc320.0340.0350.0340.97×1.00×
divmod0.0130.0150.0170.87×0.76×
fannkuch0.0170.0140.0141.21×1.21×
fasta0.0450.0450.0351.00×1.29×
fib380.0510.0380.0691.34×0.74×
floatloop0.0660.0790.0660.84×1.00×
graph0.00480.00470.00461.02×1.04×
hello †0.00010.00030.00030.33×0.33×
histogram0.0320.0320.0261.00×1.23×
interp0.0230.0220.0851.05×0.27×
knucleotide0.0330.0210.0231.57×1.43×
kostya_bf_bench0.9930.8171.0281.22×0.97×
kostya_json0.0160.0170.0170.94×0.94×
kostya_matmul0.0270.0250.0271.08×1.00×
levenshtein0.2000.1970.1391.02×1.44×
lexer0.00270.00340.00380.79×0.71×
list_sum0.00400.00880.00930.45×0.43×
loop_sum0.1880.1890.1870.99×1.01×
loops0.1450.1450.1251.00×1.16×
lru0.0190.0150.0141.27×1.36×
mandelbrot0.0120.00960.0101.25×1.20×
mapwork0.00370.00210.00641.76×0.58×
matmul0.0140.00760.0171.84×0.82×
nbody0.0100.00790.00861.27×1.16×
nqueen0.1500.1450.1451.03×1.03×
primes0.0510.0570.0510.89×1.00×
resultpath0.0100.00640.00861.56×1.16×
sieve0.0200.0240.0230.83×0.87×
sortwork0.0130.0890.0180.15×0.72×
spectralnorm0.1360.1350.1381.01×0.99×
strbuild †0.00170.00130.00161.31×1.06×
strsplit0.00600.00750.00540.80×1.11×
structlist0.0110.00500.00672.20×1.64×
structloop †0.00150.00480.00210.31×0.71×
switchwork0.0160.0190.0170.84×0.94×
tak0.0370.0800.0800.46×0.46×
wordfreq0.00830.00740.00981.12×0.85×
geometric mean of 381.02×0.94×

† runs in under 2 ms: start-up noise, shown but left out of the means and the counts.

Where Pelago is slower

Pelago is not faster than C everywhere, and the table shows every row. Against gcc -O2 the largest gaps are structlist (2.20×), bintrees (2.07×), matmul (1.84×), mapwork (1.76×), knucleotide (1.57×) and resultpath (1.56×). Against Rust the largest are structlist (1.64×), collatz (1.56×), levenshtein (1.44×) and knucleotide (1.43×). Others are slower by a third or less: fib38, blur, lru, nbody, mandelbrot, fannkuch and kostya_bf_bench.

Two rows need context. bintrees is 7.6× slower than a hand-tuned C++ variant that allocates from an arena (3.8 ms against Pelago's 29 ms), and levenshtein is 1.5× slower than clang -O2 (0.133 s against 0.200 s) even though it ties gcc -O2. The table compares against gcc -O2 as published; the full per-compiler numbers are in the run linked below.

How to read this

Binary size

Pelago writes executables directly, with no linker and no C library, so they are small: between 2 and 19 KiB here, against 16 to 20 KiB for gcc -O2 and about 4.4 MiB for rustc -O. tcc, the small C compiler, still produces smaller files than Pelago on 31 of the 41 programs (typically 3 to 6 KiB against Pelago's 5 to 12). Closing that gap is a goal; it is not reached.

programPelagotccgcc -O2rustc -O
base64146164,438
bintrees64204,434
blur54164,435
collatz33164,431
crc3253164,432
divmod33164,431
fannkuch84164,433
fasta64164,432
fib3833164,431
floatloop73164,456
graph64164,433
hello23164,431
histogram53164,432
interp64164,434
knucleotide124164,455
kostya_bf_bench95164,435
kostya_json199204,472
kostya_matmul124164,461
levenshtein115164,434
lexer64164,435
list_sum53164,433
loop_sum33164,431
loops53164,432
lru74164,433
mandelbrot33164,432
mapwork94164,454
matmul64164,432
nbody126164,459
nqueen33164,432
primes146164,443
resultpath54164,431
sieve33164,432
sortwork74164,440
spectralnorm104164,457
strbuild53164,432
strsplit84164,434
structlist54164,433
structloop33164,432
switchwork65164,433
tak33164,432
wordfreq104164,458

This run

Date
2026-11-07
Machine
Blacksmith 4 vCPU x86-64 bare-metal runner (Ubuntu 24.04). Bare-metal runners are less noisy than shared ones, but absolute times still vary between runs
Source
Pelago commit 46815fa, optimised native backend; the bench-harness run holds the full tables and raw numbers
Method
problem size medium; at least 5 timed runs per executable after one warm-up, the fastest and slowest 20% dropped, median reported (more runs while noisy)
Compilers
gcc -O2, rustc -O, tcc, clang -O2, g++ -O2 as installed on Ubuntu 24.04 and the stable Rust toolchain on the day; Pelago stage 0 native backend

Run it yourself from a checkout of the compiler (needs gcc and Python 3; the other compilers add their columns):

python3 bench/harness/run.py --runs 5 --size medium

The sources of every benchmark, with their C, C++ and Rust twins, are in bench in the compiler repository, and the workflow is bench-harness under its Actions tab.