Native nib (LLVM, LTO), Go 1.26.7 and Rust 1.98.1 on one machine: an AMD
Ryzen 7 5800H (8 cores / 16 threads), 8 GB, Linux 7.0, in a container shared
with other services. Reproduce with bash run.sh (see its header).
Same algorithm in all three languages, written the way an experienced
developer of each would write it: single-threaded, no SIMD, no unsafe, no
arenas, no third-party crates. Every program's output is checked
byte-for-byte against Rust's before it is timed. Sizes are the Game's or a
little smaller. Times are the median of 5 runs after 1 warm-up (hyperfine).
Memory is peak RSS.
| program | what it stresses | Rust | Go | nib | nib ÷ Rust | nib ÷ Go |
|---|---|---|---|---|---|---|
| binary-trees (depth 21) | allocating and freeing small objects | 9.80 s · 263 MB | 14.33 s · 205 MB | 9.76 s · 263 MB | 1.00× | 0.68× |
| fannkuch-redux (n = 11) | integer loops over small arrays | 1.96 s | 1.92 s | 3.65 s | 1.9× | 1.9× |
| fasta (n = 2.5 M) | integer RNG, string building, 25 MB of output | 0.27 s | 0.30 s | 0.40 s | 1.5× | 1.3× |
| k-nucleotide (25 MB input) | substring keys in a map | 2.14 s · 51 MB | 3.20 s · 95 MB | 5.21 s · 103 MB | 2.4× | 1.6× |
| reverse-complement (25 MB) | byte transforms | 0.06 s · 51 MB | 0.09 s · 91 MB | 0.15 s · 95 MB | 2.5× | 1.8× |
| spectral-norm (n = 2500) | floating-point loops | 0.28 s | 0.28 s | 0.35 s | 1.3× | 1.3× |
| mandelbrot (4000²) | floating-point loops | 0.89 s | 0.91 s | 0.89 s | 1.00× | 0.98× |
| n-body (5 M steps) | floating-point loops | 0.19 s | 0.29 s | 0.49 s | 2.6× | 1.7× |
Geometric mean over all eight: nib takes 1.65× Rust's time and 1.34× Go's; Go takes 1.24× Rust's.
binary-trees varies by up to ±1.9 s from run to run on this shared machine; nib and Rust are level there, and nib's lead over Go is well outside it.
The same image and output as mandelbrot above, with its rows spread over
cores 0–7 (bash run.sh par). Rust starts one scoped thread per core and Go
one goroutine per GOMAXPROCS, each taking the next row from a shared atomic
counter. nib's program has no threads in it: its rows are a Vec.map whose
callback is pure, which the compiler runs on its own pool of threads, one per
core the process may use.
| program | Rust | Go | nib |
|---|---|---|---|
| mandelbrot, one thread (above) | 0.89 s | 0.91 s | 0.89 s |
| mandelbrot, cores 0–7 | 0.151 s | 0.150 s | 0.145 s |
All three speed up about 6× on eight cores. The difference between them is within run-to-run spread; what differs is that nib's source is the serial program with its loop written as a map.
1024 accounts, each keeping its most recent deposits; GET /a/<id> deposits
into one and answers the sum of what it keeps (bash run.sh state). Every
account starts with a full window of zero deposits, so every request does
the same work from the first one on, whatever ran before it. The servers are
the HTTP section's frameworks. nib keeps the ledgers in a keyed effector cell
and the program has no lock: each request claims its own account. Rust
(Mutex<HashMap>) and Go (sync.Mutex and a map) run twice, with one lock
for every account and with 16 locks chosen by the account's hash. wrk walks
the accounts in turn (accounts.lua); every server gives the same answers to
one sequence of requests. Server on cores 0–7, wrk on 8–15, 15 s per point,
req/s:
| accounts keep | connections | nib | Rust, 1 lock | Rust, 16 locks | Go, 1 lock | Go, 16 locks |
|---|---|---|---|---|---|---|
| 32 deposits | 64 | 264 k | 246 k | 222 k | 217 k | 218 k |
| 32 deposits | 256 | 269 k | 269 k | 262 k | 225 k | 229 k |
| 4096 deposits | 64 | 256 k | 264 k | 254 k | 112 k | 212 k |
| 4096 deposits | 256 | 254 k | 268 k | 265 k | 139 k | 208 k |
With 32 deposits no server is held back by its lock: one and sixteen serve
the same, and nib is level with Rust and ahead of Go. With 4096 (32 KB per
account) a request holds its account for a sum of 4096 numbers, and Go's one
lock becomes the bottleneck — every request waits for every other — until
the map is split by hand. nib's program names no lock and serves within 5 %
of Rust and ahead of both Go servers. Its deposit runs in the account's
own storage and, since it reads the account once and then writes it, moves
the vector out of the cell and back: Vec.push and Vec.drop(kept, 1) work
in place, as Go's append does (Rust's VecDeque drops from the front in
O(1)). What nib's claims win is in the program: no lock to declare, take,
release, order or split.
Each server is its language's idiomatic choice: nib's std/server.nib
(Server.run), Go's net/http + encoding/json, and Rust's axum on tokio +
serde. Each server was pinned to cores 0–7 (8 workers), and wrk (4 threads,
HTTP/1.1 keep-alive, no pipelining) to cores 8–15. Each point ran for 15 s.
Response sizes are comparable: 112–131 B for nib, 124–144 B for Go and Rust.
No server answered an error.
| test | connections | Rust (axum) | Go (net/http) | nib |
|---|---|---|---|---|
| /plaintext | 64 | 286 k req/s · p99 0.75 ms | 241 k · 1.50 ms | 276 k · 2.58 ms |
| /json | 64 | 290 k · 0.67 ms | 234 k · 1.55 ms | 302 k · 0.38 ms |
| /plaintext | 256 | 298 k · 2.14 ms | 242 k · 5.40 ms | 305 k · 2.36 ms |
| /json | 256 | 306 k · 1.70 ms | 240 k · 5.30 ms | 296 k · 1.38 ms |
Tail latency on this shared machine is noisy: the same build's p99 at 64 connections moves between 0.3 ms and 2.8 ms from one 15 s run to the next, while throughput and the median hold steady. The p99 column is a sample, not a ranking; throughput is stable to a few percent.
Box/malloc both pay more per node. (The Game's
fastest Rust entry uses an arena and would be about 3× quicker. Arenas were
excluded here for all three languages.)Vec.map whose
callback performs no effect and raises nothing is run in parallel by the
compiler, as fast as hand-threaded Rust and Go.Mutex<HashMap> while each key's state is small, and
within 5 % of it with 32 KB per key, ahead of Go with one lock or sixteen.net/http. Per-core
io_uring fibres with no shared scheduler serve about 300 k req/s.Vec<Float> holds raw doubles. Both
nib and Rust keep n-body's bodies in a heap vector; Rust's compiler can see
there are five of them, so it unrolls every loop and drops every index
check. nib's pair loop is one flat loop with two counters, which it
cannot unroll, so each of its 18 accesses per pair is bounds-checked
index arithmetic on 63-bit Ints.match;1e-3).Json.render needs a declared type, not an anonymous record.1# nib vs Go vs Rust — measured 2026-11-22 2 3Native nib (LLVM, LTO), Go 1.26.7 and Rust 1.98.1 on one machine: an AMD 4Ryzen 7 5800H (8 cores / 16 threads), 8 GB, Linux 7.0, in a container shared 5with other services. Reproduce with `bash run.sh` (see its header). 6 7## The eight Benchmarks Game programs 8 9Same algorithm in all three languages, written the way an experienced 10developer of each would write it: single-threaded, no SIMD, no `unsafe`, no 11arenas, no third-party crates. Every program's output is checked 12byte-for-byte against Rust's before it is timed. Sizes are the Game's or a 13little smaller. Times are the median of 5 runs after 1 warm-up (hyperfine). 14Memory is peak RSS. 15 16| program | what it stresses | Rust | Go | nib | nib ÷ Rust | nib ÷ Go | 17|---|---|---:|---:|---:|---:|---:| 18| binary-trees (depth 21) | allocating and freeing small objects | 9.80 s · 263 MB | 14.33 s · 205 MB | **9.76 s** · 263 MB | **1.00×** | **0.68×** | 19| fannkuch-redux (n = 11) | integer loops over small arrays | 1.96 s | 1.92 s | 3.65 s | 1.9× | 1.9× | 20| fasta (n = 2.5 M) | integer RNG, string building, 25 MB of output | 0.27 s | 0.30 s | 0.40 s | 1.5× | 1.3× | 21| k-nucleotide (25 MB input) | substring keys in a map | 2.14 s · 51 MB | 3.20 s · 95 MB | 5.21 s · 103 MB | 2.4× | 1.6× | 22| reverse-complement (25 MB) | byte transforms | 0.06 s · 51 MB | 0.09 s · 91 MB | 0.15 s · 95 MB | 2.5× | 1.8× | 23| spectral-norm (n = 2500) | floating-point loops | 0.28 s | 0.28 s | 0.35 s | 1.3× | 1.3× | 24| mandelbrot (4000²) | floating-point loops | 0.89 s | 0.91 s | **0.89 s** | **1.00×** | **0.98×** | 25| n-body (5 M steps) | floating-point loops | 0.19 s | 0.29 s | 0.49 s | 2.6× | 1.7× | 26 27Geometric mean over all eight: nib takes **1.65×** Rust's time and 28**1.34×** Go's; Go takes 1.24× Rust's. 29 30binary-trees varies by up to ±1.9 s from run to run on this shared machine; 31nib and Rust are level there, and nib's lead over Go is well outside it. 32 33## Parallel: mandelbrot on eight cores 34 35The same image and output as mandelbrot above, with its rows spread over 36cores 0–7 (`bash run.sh par`). Rust starts one scoped thread per core and Go 37one goroutine per `GOMAXPROCS`, each taking the next row from a shared atomic 38counter. nib's program has no threads in it: its rows are a `Vec.map` whose 39callback is pure, which the compiler runs on its own pool of threads, one per 40core the process may use. 41 42| program | Rust | Go | nib | 43|---|---:|---:|---:| 44| mandelbrot, one thread (above) | 0.89 s | 0.91 s | 0.89 s | 45| mandelbrot, cores 0–7 | 0.151 s | 0.150 s | **0.145 s** | 46 47All three speed up about 6× on eight cores. The difference between them is 48within run-to-run spread; what differs is that nib's source is the serial 49program with its loop written as a map. 50 51## Shared state: an accounts server 52 531024 accounts, each keeping its most recent deposits; `GET /a/<id>` deposits 54into one and answers the sum of what it keeps (`bash run.sh state`). Every 55account starts with a full window of zero deposits, so every request does 56the same work from the first one on, whatever ran before it. The servers are 57the HTTP section's frameworks. nib keeps the ledgers in a keyed effector cell 58and the program has no lock: each request claims its own account. Rust 59(`Mutex<HashMap>`) and Go (`sync.Mutex` and a map) run twice, with one lock 60for every account and with 16 locks chosen by the account's hash. `wrk` walks 61the accounts in turn (`accounts.lua`); every server gives the same answers to 62one sequence of requests. Server on cores 0–7, `wrk` on 8–15, 15 s per point, 63req/s: 64 65| accounts keep | connections | nib | Rust, 1 lock | Rust, 16 locks | Go, 1 lock | Go, 16 locks | 66|---|---:|---:|---:|---:|---:|---:| 67| 32 deposits | 64 | **264 k** | 246 k | 222 k | 217 k | 218 k | 68| 32 deposits | 256 | **269 k** | 269 k | 262 k | 225 k | 229 k | 69| 4096 deposits | 64 | 256 k | **264 k** | 254 k | 112 k | 212 k | 70| 4096 deposits | 256 | 254 k | **268 k** | 265 k | 139 k | 208 k | 71 72With 32 deposits no server is held back by its lock: one and sixteen serve 73the same, and nib is level with Rust and ahead of Go. With 4096 (32 KB per 74account) a request holds its account for a sum of 4096 numbers, and Go's one 75lock becomes the bottleneck — every request waits for every other — until 76the map is split by hand. nib's program names no lock and serves within 5 % 77of Rust and ahead of both Go servers. Its `deposit` runs in the account's 78own storage and, since it reads the account once and then writes it, moves 79the vector out of the cell and back: `Vec.push` and `Vec.drop(kept, 1)` work 80in place, as Go's `append` does (Rust's `VecDeque` drops from the front in 81O(1)). What nib's claims win is in the program: no lock to declare, take, 82release, order or split. 83 84## HTTP: plaintext and JSON (TechEmpower's two simplest tests) 85 86Each server is its language's idiomatic choice: nib's `std/server.nib` 87(`Server.run`), Go's `net/http` + `encoding/json`, and Rust's axum on tokio + 88serde. Each server was pinned to cores 0–7 (8 workers), and `wrk` (4 threads, 89HTTP/1.1 keep-alive, no pipelining) to cores 8–15. Each point ran for 15 s. 90Response sizes are comparable: 112–131 B for nib, 124–144 B for Go and Rust. 91No server answered an error. 92 93| test | connections | Rust (axum) | Go (net/http) | nib | 94|---|---:|---:|---:|---:| 95| /plaintext | 64 | **286 k** req/s · p99 0.75 ms | 241 k · 1.50 ms | 276 k · 2.58 ms | 96| /json | 64 | 290 k · 0.67 ms | 234 k · 1.55 ms | **302 k** · 0.38 ms | 97| /plaintext | 256 | 298 k · 2.14 ms | 242 k · 5.40 ms | **305 k** · 2.36 ms | 98| /json | 256 | **306 k** · 1.70 ms | 240 k · 5.30 ms | 296 k · 1.38 ms | 99 100Tail latency on this shared machine is noisy: the same build's p99 at 64 101connections moves between 0.3 ms and 2.8 ms from one 15 s run to the next, 102while throughput and the median hold steady. The p99 column is a sample, not 103a ranking; throughput is stable to a few percent. 104 105## What this says 106 107- **Allocation-heavy code is ahead of Go and level with Rust.** 108 Reference-counted regions free a tree as soon as it is dropped. Go's GC and 109 Rust's general-purpose `Box`/malloc both pay more per node. (The Game's 110 fastest Rust entry uses an arena and would be about 3× quicker. Arenas were 111 excluded here for all three languages.) 112- **A pure map uses every core with no threading code.** A `Vec.map` whose 113 callback performs no effect and raises nothing is run in parallel by the 114 compiler, as fast as hand-threaded Rust and Go. 115- **Shared per-key state needs no locks and keeps pace.** A keyed cell is 116 level with a Rust `Mutex<HashMap>` while each key's state is small, and 117 within 5 % of it with 32 KB per key, ahead of Go with one lock or sixteen. 118- **HTTP serving is level with axum and ahead of `net/http`.** Per-core 119 io_uring fibres with no shared scheduler serve about 300 k req/s. 120- **Floating point is at or near parity, except n-body.** Floats are unboxed 121 in locals and loop variables, and a `Vec<Float>` holds raw doubles. Both 122 nib and Rust keep n-body's bodies in a heap vector; Rust's compiler can see 123 there are five of them, so it unrolls every loop and drops every index 124 check. nib's pair loop is one flat loop with two counters, which it 125 cannot unroll, so each of its 18 accesses per pair is bounds-checked 126 index arithmetic on 63-bit Ints. 127- **Integer, string and map code is 1.5–2.5× slower.** The remaining causes, 128 in rough order of cost: 129 - every Vec/Bytes/String access is bounds-checked, and a String or Bytes 130 one goes through a runtime call (fannkuch, revcomp); 131 - a Map is a persistent hash trie: with millions of keys a lookup follows 132 4–5 dependent nodes where Rust's hash table touches about two cache 133 lines, and each key is a fresh String (k-nucleotide). 134 135## What writing these programs ran into (nib gaps, not timings) 136 137- **The syntax is missing pieces:** 138 - a tuple cannot be a function's declared return type, and tuple patterns 139 do not parse in `match`; 140 - there are no exponent literals (`1e-3`). 141- **The library is missing pieces:** 142 - there is no upper-casing, and no string-to-Int parsing; 143 - there is no stdin, so input is a file path argument; 144 - there are no bitwise operators; 145 - raw bytes cannot be written to stdout. Mandelbrot therefore prints the 146 sum of its packed bytes in all three languages, not a PBM image. 147- **Native `Json.render` needs a declared type**, not an anonymous record.