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.
| program | seconds, median of at least 5 Pelago C -O2 Rust -O | vs C -O2 | vs Rust |
|---|---|---|---|
| base64 | 1.19× | 0.58× | |
| bintrees | 2.07× | 1.12× | |
| blur | 1.30× | 0.91× | |
| collatz | 0.91× | 1.56× | |
| crc32 | 0.97× | 1.00× | |
| divmod | 0.87× | 0.76× | |
| fannkuch | 1.21× | 1.21× | |
| fasta | 1.00× | 1.29× | |
| fib38 | 1.34× | 0.74× | |
| floatloop | 0.84× | 1.00× | |
| graph | 1.02× | 1.04× | |
| hello † | 0.33× | 0.33× | |
| histogram | 1.00× | 1.23× | |
| interp | 1.05× | 0.27× | |
| knucleotide | 1.57× | 1.43× | |
| kostya_bf_bench | 1.22× | 0.97× | |
| kostya_json | 0.94× | 0.94× | |
| kostya_matmul | 1.08× | 1.00× | |
| levenshtein | 1.02× | 1.44× | |
| lexer | 0.79× | 0.71× | |
| list_sum | 0.45× | 0.43× | |
| loop_sum | 0.99× | 1.01× | |
| loops | 1.00× | 1.16× | |
| lru | 1.27× | 1.36× | |
| mandelbrot | 1.25× | 1.20× | |
| mapwork | 1.76× | 0.58× | |
| matmul | 1.84× | 0.82× | |
| nbody | 1.27× | 1.16× | |
| nqueen | 1.03× | 1.03× | |
| primes | 0.89× | 1.00× | |
| resultpath | 1.56× | 1.16× | |
| sieve | 0.83× | 0.87× | |
| sortwork | 0.15× | 0.72× | |
| spectralnorm | 1.01× | 0.99× | |
| strbuild † | 1.31× | 1.06× | |
| strsplit | 0.80× | 1.11× | |
| structlist | 2.20× | 1.64× | |
| structloop † | 0.31× | 0.71× | |
| switchwork | 0.84× | 0.94× | |
| tak | 0.46× | 0.46× | |
| wordfreq | 1.12× | 0.85× | |
| geometric mean of 38 | 1.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
- Same behaviour, not same rules. Pelago traps on integer overflow. The C and Rust builds above do not check, so they do less work. The same run also builds C with
-ftrapvand Rust with overflow checks on. Against those, Pelago's geometric mean is 0.63× ofgcc -ftrapvand 0.91× of checked Rust. - Small programs. Most run for a few to a few hundred milliseconds. They test the code generator, not whole applications, and a few percent either way is not a result.
- Output is checked. Every program prints the same output as its C twin, or the harness reports a mismatch.
- The programs are ours. Some follow the public problem descriptions of well-known suites (such as kostya and bddicken). They are rewrites, not the original sources, and each has C, C++, Rust and Pelago versions in the compiler repository.
- Other CPUs. The same run also measured AArch64 (Linux on GitHub's and Blacksmith's ARM runners). Those results are in the run's artifacts but are not summarised on this page yet, so no ARM figure is claimed here. The x86-64 backend has had the most tuning.
- Small and register-poor targets. The harness does not yet measure microcontroller-class hardware or a register-limited code generator, so this page makes no claim about them.
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.
| program | Pelago | tcc | gcc -O2 | rustc -O |
|---|---|---|---|---|
| base64 | 14 | 6 | 16 | 4,438 |
| bintrees | 6 | 4 | 20 | 4,434 |
| blur | 5 | 4 | 16 | 4,435 |
| collatz | 3 | 3 | 16 | 4,431 |
| crc32 | 5 | 3 | 16 | 4,432 |
| divmod | 3 | 3 | 16 | 4,431 |
| fannkuch | 8 | 4 | 16 | 4,433 |
| fasta | 6 | 4 | 16 | 4,432 |
| fib38 | 3 | 3 | 16 | 4,431 |
| floatloop | 7 | 3 | 16 | 4,456 |
| graph | 6 | 4 | 16 | 4,433 |
| hello | 2 | 3 | 16 | 4,431 |
| histogram | 5 | 3 | 16 | 4,432 |
| interp | 6 | 4 | 16 | 4,434 |
| knucleotide | 12 | 4 | 16 | 4,455 |
| kostya_bf_bench | 9 | 5 | 16 | 4,435 |
| kostya_json | 19 | 9 | 20 | 4,472 |
| kostya_matmul | 12 | 4 | 16 | 4,461 |
| levenshtein | 11 | 5 | 16 | 4,434 |
| lexer | 6 | 4 | 16 | 4,435 |
| list_sum | 5 | 3 | 16 | 4,433 |
| loop_sum | 3 | 3 | 16 | 4,431 |
| loops | 5 | 3 | 16 | 4,432 |
| lru | 7 | 4 | 16 | 4,433 |
| mandelbrot | 3 | 3 | 16 | 4,432 |
| mapwork | 9 | 4 | 16 | 4,454 |
| matmul | 6 | 4 | 16 | 4,432 |
| nbody | 12 | 6 | 16 | 4,459 |
| nqueen | 3 | 3 | 16 | 4,432 |
| primes | 14 | 6 | 16 | 4,443 |
| resultpath | 5 | 4 | 16 | 4,431 |
| sieve | 3 | 3 | 16 | 4,432 |
| sortwork | 7 | 4 | 16 | 4,440 |
| spectralnorm | 10 | 4 | 16 | 4,457 |
| strbuild | 5 | 3 | 16 | 4,432 |
| strsplit | 8 | 4 | 16 | 4,434 |
| structlist | 5 | 4 | 16 | 4,433 |
| structloop | 3 | 3 | 16 | 4,432 |
| switchwork | 6 | 5 | 16 | 4,433 |
| tak | 3 | 3 | 16 | 4,432 |
| wordfreq | 10 | 4 | 16 | 4,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-harnessrun 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++ -O2as 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.