Benchmarks

Greengold, C++, and Rust on seventeen workloads, measured on 9 October 2026. Full numbers: benchmarks/data.json.

The builds are g++ -O3, rustc -C opt-level=3, and greengold build --release. --release keeps bounds checks and integer overflow traps.

Timed programs show the median of five runs. The primes drag race is one run of about 20 seconds, scored by completed passes. Memory is peak working set. On each chart, languages run from best to worst, left to right. A gap of 5% or less is treated as noise.

AMD Ryzen 5 5600X (6 cores, 12 threads), 32 GB DDR4-3600, Windows 11 Pro build 26200. g++ 15.2.0, rustc 1.99.0-nightly (12c36e253, 2026-08-10), Python 3.11.5, llvmlite 0.42.0.

Fibonacci · Collatz · Fannkuch · Mandelbrot · N-body · Spectral · Matmul · Heat · Monte Carlo · FNV · Quicksort · Dijkstra · Sieve · Primes · Vector · Trees · Particle

Gaps

Median against the faster of C++ and Rust.

Within 5%

Milliseconds. Lower is faster.
Program C++ Rust Greengold Gap
collatz 479.48 432.80 447.82 +15.02 ms3.5%
mandel 322.52 326.18 332.68 +10.16 ms3.2%
spectral 221.06 211.73 216.51 +4.78 ms2.3%
heat 135.84 136.50 139.26 +3.42 ms2.5%
monte 425.72 389.54 393.09 +3.55 ms0.9%
fnv 301.57 346.50 301.61 +0.04 ms0.0%
trees 487.60 484.03 493.15 +9.12 ms1.9%

Above 5%

Milliseconds. Lower is faster.
Program C++ Rust Greengold Gap
fannkuch 450.89 387.17 481.05 +93.88 ms24.2%
nbody 257.50 251.31 287.30 +35.99 ms14.3%
sieve 18.07 17.24 21.53 +4.29 ms24.9%

Median runtime

Milliseconds. Lower is faster.

Program C++ Rust Greengold
fib(41) 260.46 387.70 42.27
collatz 479.48 432.80 447.82
fannkuch 450.89 387.17 481.05
mandel 322.52 326.18 332.68
nbody 257.50 251.31 287.30
spectral 221.06 211.73 216.51
matmul 427.07 411.66 338.04
heat 135.84 136.50 139.26
monte 425.72 389.54 393.09
fnv 301.57 346.50 301.61
qsort 563.86 512.55 452.76
dijkstra 191.72 175.20 165.85
sieve 18.07 17.24 21.53
vector 83.23 84.29 80.36
trees 487.60 484.03 493.15
particle 19.64 19.81 12.25

On this run, Greengold’s median is the lowest on fib, matmul, qsort, dijkstra, vector, and particle. On the primes drag race it completed the most passes.

Primes drag race

Completed sieve passes. The program loops for about 20 seconds. Higher is faster.

Program C++ Rust Greengold
primes 29365 31641 32240

Fibonacci

Recursive fib(41). Each program printed 165580141. The Greengold version uses overflow: wrap.

Build Median Mean Memory Compile Binary
C++ (GCC -O3)260.46 ms269.76 ms4.66 MB0.45 s64.0 KB
Rust (opt-level = 3)387.70 ms412.68 ms4.19 MB0.26 s137.0 KB
Greengold --release42.27 ms44.13 ms4.07 MB0.33 s58.2 KB

Source: fib.gg · fib.cpp · fib.rs

Collatz

For each integer from 1 up to, but not including, 4,000,000, count the steps until the value reaches 1. All three programs printed 3732423 and 596. Greengold is about the same as Rust.

Build Median Mean Memory Compile Binary
C++ (GCC -O3)479.48 ms492.31 ms4.63 MB0.40 s59.4 KB
Rust (opt-level = 3)432.80 ms448.71 ms4.17 MB0.17 s128.0 KB
Greengold --release447.82 ms451.19 ms4.07 MB0.33 s58.2 KB

Source: collatz.gg · collatz.cpp · collatz.rs

Fannkuch

Every permutation of ten items, repeated four times. Each program printed 292784 and 38. Greengold indexes with trust inside hot fn, and the checksum uses overflow: wrap.

Build Median Mean Memory Compile Binary
C++ (GCC -O3)450.89 ms457.82 ms4.62 MB0.43 s59.8 KB
Rust (opt-level = 3)387.17 ms408.37 ms4.18 MB0.20 s128.5 KB
Greengold --release481.05 ms491.14 ms4.07 MB0.37 s59.4 KB

Source: fannkuch.gg · fannkuch.cpp · fannkuch.rs

Mandelbrot

2048 by 2048 pixels, at most 80 iterations, on the plane [−1.5, 0.5] × [−1, 1]. Each program printed 1632341, the count of pixels that reached 80 iterations. The Greengold iterator is hot fn with overflow: wrap. Greengold is about the same as C++.

Build Median Mean Memory Compile Binary
C++ (GCC -O3)322.52 ms327.26 ms4.63 MB0.41 s59.7 KB
Rust (opt-level = 3)326.18 ms356.47 ms4.17 MB0.17 s127.5 KB
Greengold --release332.68 ms334.97 ms4.07 MB0.35 s59.4 KB

Source: mandel.gg · mandel.cpp · mandel.rs

N-body

768 bodies, 160 steps, softening 0.05. Positions are parallel arrays in all three programs. Greengold uses hot fn, exclusive lend, trust, and overflow: wrap. Each program printed -51022, 15923, and 45852.

Build Median Mean Memory Compile Binary
C++ (GCC -O3)257.50 ms265.12 ms4.66 MB0.55 s65.3 KB
Rust (opt-level = 3)251.31 ms258.31 ms4.20 MB0.22 s132.5 KB
Greengold --release287.30 ms279.73 ms4.11 MB0.46 s62.2 KB

Source: nbody.gg · nbody.cpp · nbody.rs

Spectral

Power iteration on an implicit matrix, n = 1600, forty applications of A twice. Greengold uses hot fn, exclusive lend, trust, and overflow: wrap. Each program printed 1122277722. Greengold is about the same as Rust.

Build Median Mean Memory Compile Binary
C++ (GCC -O3)221.06 ms226.21 ms4.66 MB0.54 s62.1 KB
Rust (opt-level = 3)211.73 ms243.34 ms4.18 MB0.26 s129.0 KB
Greengold --release216.51 ms223.44 ms4.09 MB0.67 s60.8 KB

Source: spectral.gg · spectral.cpp · spectral.rs

Matmul

Naive i-k-j product of two 1216×1216 f64 matrices. Greengold uses hot fn, exclusive lend, trust, and overflow: wrap. Each program printed 86306145685, 58018, and 58672. Greengold’s peak memory is 39.66 MB; C++ is 38.01 MB and Rust is 37.58 MB.

Build Median Mean Memory Compile Binary
C++ (GCC -O3)427.07 ms406.20 ms38.01 MB0.55 s63.2 KB
Rust (opt-level = 3)411.66 ms480.18 ms37.58 MB0.22 s130.0 KB
Greengold --release338.04 ms348.30 ms39.66 MB0.37 s60.7 KB

Source: matmul.gg · matmul.cpp · matmul.rs

Heat

Jacobi stencil on a 1024×1024 grid, 320 steps. Greengold uses hot fn, exclusive lend, trust, and overflow: wrap. Each program printed 9259564379. Greengold is about the same as C++ and Rust.

Build Median Mean Memory Compile Binary
C++ (GCC -O3)135.84 ms144.34 ms20.16 MB0.51 s62.2 KB
Rust (opt-level = 3)136.50 ms192.26 ms19.73 MB0.22 s130.5 KB
Greengold --release139.26 ms168.86 ms20.69 MB0.41 s60.7 KB

Source: heat.gg · heat.cpp · heat.rs

Monte Carlo

One hundred twenty million xorshift64* samples. The printed value is the number of points inside the unit circle. Greengold keeps the generator in one hot fn with overflow: wrap. Each program printed 94241925. Greengold is about the same as Rust.

Build Median Mean Memory Compile Binary
C++ (GCC -O3)425.72 ms432.05 ms4.63 MB0.45 s59.3 KB
Rust (opt-level = 3)389.54 ms395.52 ms4.17 MB0.17 s128.0 KB
Greengold --release393.09 ms405.47 ms4.07 MB0.32 s58.2 KB

Source: monte.gg · monte.cpp · monte.rs

FNV

FNV-1a 64 over eight million generated bytes, forty salted passes. Greengold hashes inside hot fn with wrapping arithmetic. Each program printed 16483032082770582304. Greengold is about the same as C++.

Build Median Mean Memory Compile Binary
C++ (GCC -O3)301.57 ms307.16 ms11.79 MB0.51 s61.5 KB
Rust (opt-level = 3)346.50 ms359.37 ms11.35 MB0.20 s128.0 KB
Greengold --release301.61 ms308.22 ms12.66 MB0.34 s59.6 KB

Source: fnv.gg · fnv.cpp · fnv.rs

Quicksort

Iterative quicksort of eight million i32 values, with insertion sort below 16 elements. Greengold uses hot fn, trust, and overflow: wrap. Each program printed 14, 1073845253, 2147483383, 8590112052113664, and 0. The last value is 0 when the array is sorted.

Build Median Mean Memory Compile Binary
C++ (GCC -O3)563.86 ms574.70 ms34.68 MB0.53 s63.8 KB
Rust (opt-level = 3)512.55 ms546.05 ms34.24 MB0.24 s130.5 KB
Greengold --release452.76 ms447.55 ms36.64 MB0.41 s60.7 KB

Source: qsort.gg · qsort.cpp · qsort.rs

Dijkstra

Eight dense shortest-path searches on 4,000 nodes. Edge weights are computed, not stored. Greengold uses hot fn, exclusive lend, trust, and overflow: wrap. Each program printed 251696.

Build Median Mean Memory Compile Binary
C++ (GCC -O3)191.72 ms197.87 ms4.65 MB0.48 s62.0 KB
Rust (opt-level = 3)175.20 ms210.86 ms4.20 MB0.26 s129.0 KB
Greengold --release165.85 ms169.09 ms4.07 MB0.42 s60.2 KB

Source: dijkstra.gg · dijkstra.cpp · dijkstra.rs

Sieve

Count the primes below 8,000,000. Each program printed 539777. The Greengold program indexes with trust. Rust’s mean, 76.62 ms, sits well above its median, 17.24 ms.

Build Median Mean Memory Compile Binary
C++ (GCC -O3)18.07 ms25.67 ms11.74 MB0.52 s61.6 KB
Rust (opt-level = 3)17.24 ms76.62 ms11.32 MB0.19 s128.0 KB
Greengold --release21.53 ms27.85 ms12.65 MB0.35 s59.6 KB

Source: sieve.gg · sieve.cpp · sieve.rs

Primes

A one-bit sieve of limit 1,000,000, repeated for about 20 seconds. The score is completed passes. Each program counted 78,498 primes. Greengold indexes the bit words with trust.

Build Passes Passes/s Memory Compile Binary
C++ (GCC -O3)293651462.24.61 MB0.64 s94.3 KB
Rust (opt-level = 3)316411578.04.17 MB0.21 s155.0 KB
Greengold --release322401609.64.43 MB0.39 s60.6 KB

Source: primes.gg · primes.cpp · primes.rs

Vector

Push the integers 0 through 19,999,999 onto a list, then sum them. All three programs printed 20000000 and 199999990000000. Peak memory is about 261 MB because the list holds twenty million i64 values.

Build Median Mean Memory Compile Binary
C++ (GCC -O3)83.23 ms89.01 ms261.11 MB0.43 s61.5 KB
Rust (opt-level = 3)84.29 ms90.54 ms260.71 MB0.20 s128.5 KB
Greengold --release80.36 ms83.24 ms260.65 MB0.35 s59.6 KB

Source: vector.gg · vector.cpp · vector.rs

Trees

A full binary tree of depth 16, built and counted eighty times, then freed. Greengold stores children in Box and walks the tree by borrow. Each program printed 5242880. Greengold is about the same as Rust and C++.

Build Median Mean Memory Compile Binary
C++ (GCC -O3)487.60 ms525.59 ms8.23 MB1.13 s110.6 KB
Rust (opt-level = 3)484.03 ms515.88 ms7.76 MB0.18 s129.0 KB
Greengold --release493.15 ms512.27 ms7.70 MB0.37 s60.6 KB

Source: trees.gg · trees.cpp · trees.rs

Particle

20,000 particles, 2,000 steps, then the sum of x. Greengold uses soa Array and indexes it with trust inside hot fn. C++ and Rust store an array of structs. Printed sums: C++ 5.99982e+07, Rust 59998190, Greengold 5.9999e+07. Rust’s mean, 66.71 ms, sits well above its median, 19.81 ms.

Build Median Mean Memory Compile Binary
C++ (GCC -O3)19.64 ms25.86 ms4.97 MB0.45 s60.5 KB
Rust (opt-level = 3)19.81 ms66.71 ms4.46 MB0.19 s150.0 KB
Greengold --release12.25 ms16.66 ms4.41 MB2.11 s58.9 KB

Source: particle.gg · particle.cpp · particle.rs