Benchmarks

Generated by node bench/run.mjs, except the JSON section at the end, which node bench/json-compare/run.mjs --record writes; do not edit by hand. The programs, the rules and the analysis of every gap are in bench/README.md and docs/wp9-optimisation.md.

Date 2026-10-11
nish nish 0.18.0 (commit 7b63d873)
CPU Intel(R) Xeon(R) Processor @ 2.10GHz, 4 logical cores
OS linux 6.18.44-fc-v114 (x64)
C Ubuntu clang version 18.1.3 (1ubuntu1)
Rust rustc 1.97.0 (2d8144b78 2026-07-07)
Go go version go1.24.7 linux/amd64
Node v22.22.0
Runs 5 timed after 1 warm-up, wall time via process.hrtime.bigint around spawnSync; min and median in ms

Wall time (ms, min / median)

Benchmark Nish C -O3 Go Rust -O3 Rust native Nish / Go Nish / Rust
fib 440 / 441 273 / 313 506 / 529 327 / 343 267 / 299 0.87x 1.34x
nbody 856 / 948 935 / 1033 1538 / 1582 855 / 944 859 / 937 0.56x 1.00x
spectral 383 / 460 403 / 468 519 / 556 408 / 420 458 / 467 0.74x 0.94x
sieve 1021 / 1028 892 / 965 1115 / 1154 1117 / 1327 1118 / 1289 0.92x 0.91x
strbuild 13.8 / 16.1 33.0 / 39.1 43.4 / 44.4 14.6 / 21.6 15.8 / 17.5 0.32x 0.95x
vec3 292 / 300 276 / 299 354 / 403 295 / 355 329 / 344 0.82x 0.99x
result 268 / 299 440 / 470 596 / 689 263 / 287 86.2 / 92.0 0.45x 1.02x

The ratio columns divide the Nish minimum by that language's minimum (Rust -O3, Go): 1.00x is parity, above 1.10x misses the WP9 target. Rust native is -C target-cpu=native; C is plain -O3 without -march; Go has one optimisation level and always bounds-checks.

Binary size (bytes, stripped)

Benchmark Nish speed Nish size C -O3 Go Rust -O3
fib 5,824 5,760 14,520 1,429,688 341,208
nbody 22,560 19,344 14,528 1,433,784 368,920
spectral 20,024 19,608 14,544 1,429,688 366,752
sieve 6,984 6,968 14,544 1,429,688 341,472
strbuild 7,616 8,224 14,544 1,429,688 343,776
vec3 18,736 17,920 14,520 1,429,688 365,440
result 5,728 5,632 14,520 1,429,688 341,160

Nish binaries link runtime/runtime.c statically and glibc dynamically; the Rust binaries carry std statically (panic=abort, strip=symbols) and the Go binaries their runtime, scheduler and garbage collector (-ldflags=-s -w).

Peak resident memory (KB)

Benchmark Nish C -O3 Go Rust -O3 Rust native
fib 1,376 2,048 1,812 2,132 2,260
nbody 1,392 2,040 1,808 2,224 2,248
spectral 1,520 2,168 1,812 2,192 2,200
sieve 11,108 11,740 11,668 11,724 11,712
strbuild 16,484 48,512 8,320 3,676 3,676
vec3 1,376 2,104 1,684 2,172 2,172
result 1,376 2,048 1,748 2,200 2,200

Peak RSS of one run (ru_maxrss from wait4, see bench/rss.c). String building used to hold every intermediate string until exit, because each join returns its result and the automatic arena scopes (WP6) cannot reclaim an escaping value; the call-site reclaim in docs/wp9-optimisation.md now frees a returned string's intermediates at the call.

Data parallelism (ms, min / median)

Each kernel is one Nish binary, run as the loop a program writes without nish/threads (seq) and as parallelMapInto (par) on all 4 logical cores, par-histogram as a scope of four tasks sharing a Mutex and par-histogram-atomic as the same scope sharing an AtomicI32Array of the bins; the speedup is the loop's minimum over the map's. Both runs print the same checksum. The kernels are in bench/par-*.ts, and wp29 §8a reads the numbers. par-regions is what one divided region costs, and wp20 §8e has it before and after the worker pool. This table alone was measured on 2026-11-14, on Intel(R) Xeon(R) Processor @ 2.10GHz, at main at f8e21091, the base of the branch it was measured on (branch commit c1d3f06f, which a squash merge does not keep), by node bench/run.mjs --only par; the rest of the file was measured on the machine in the header.

Kernel What Loop parallelMapInto Speedup Peak RSS loop / map (KB)
par-compute 64 square roots per element, 2^21 elements (f64) 960 / 970 264 / 282 3.64x 33,968 / 34,352
par-alloc a string formatted and summed per element, 2^22 elements; the body allocates (NL9012) 210 / 219 60.0 / 63.6 3.50x 33,956 / 34,520
par-nbody n-body partitioned: 1024 bodies, 16 steps, one map of 3n probes per step 193 / 196 64.6 / 65.0 2.99x 1,588 / 1,896
par-short an 8-element map called 2^20 times, each call fed by the last 65.3 / 80.0 67.5 / 73.7 0.97x 1,316 / 1,316
par-regions a 2^17-element map called 1,000 times, each call fed by the last: what a region costs 630 / 669 60.4 / 66.0 10.44x 2,212 / 2,776
par-histogram 4 tasks bin 50,000 values each into one Mutex, a lock per value, 16 rounds: a contended lock 29.5 / 30.4 114 / 167 0.26x 1,320 / 1,628
par-histogram-atomic par-histogram with the bins one AtomicI32Array, one add per value: contended atomics, no lock 26.9 / 32.4 65.5 / 73.8 0.41x 1,316 / 1,752
par-heavy 16 integer scramble rounds per element, 2^22 elements, 40 calls; the order-sensitive fold runs on one thread 2608 / 2654 833 / 861 3.13x 34,068 / 34,340
par-heavy-fold par-heavy with a fold that vectorises: the same map, a smaller undivided part 2338 / 2508 806 / 844 2.90x 34,072 / 34,340
par-heavy4 par-heavy with 64 scramble rounds: four times the divided work, the same fold 12515 / 12691 3552 / 3750 3.52x 34,072 / 34,524
par-scale x * k over 2^22 elements, 40 calls: a memory-bound map 386 / 402 290 / 297 1.33x 34,072 / 34,344
par-single one x * 3 map over 2^25 elements: a single large region 257 / 266 217 / 226 1.18x 263,332 / 263,896

Data parallelism against Rust and Go (ms, min / median)

Five of the kernels above, each ported to Rust and to Go with the same work, the same sizes and the same checksum: every binary below printed the Nish par run's output (numeric tokens to 1e-9 relative; the n-body energies agree to the last bit). The Rust twins run on std::thread::scope (bench/par-<kernel>.rs) and on Rayon's pool (bench/par-<kernel>-rayon.rs), the Go twins on goroutines and a sync.WaitGroup (bench/par-<kernel>.go). The map twins cut the array into one contiguous chunk per thread, the first on the calling thread, as Nish's partitioner did until it began cutting up to eight pieces per thread that the threads claim as they finish (Scheduling a divided region); Rayon splits adaptively. par-histogram takes the lock once per value in every language, Nish's Mutex, Rust's std::sync::Mutex and Go's sync.Mutex, kept deliberately as a comparison of a contended lock. par-histogram-atomic bins the same values into an AtomicI32 per bin, one sequentially consistent add per value in every language, Nish's add, Rust's AtomicI32::fetch_add with SeqCst and Go's atomic.Int32.Add: the same contention on sixteen bins without the lock. The version that avoids the contention, a local tally and one add per bin, is examples/histogram-atomic.ts (the threads guide's atomics section).

The same work, not the same checks or the same build. Nish builds with its default checks: every integer operation that can overflow and every index it cannot prove in range is checked (nish_panic_overflow and nish_panic_index are reached from par-histogram's binStream, for one). The Rust twins build as --release does, with bounds checks and without overflow checks; Go checks bounds and not overflow. And Nish's --profile speed links with LTO, where neither Rust build does, which gives Nish a small edge. In par-nbody each Nish probe reaches the bodies through class references, where the twins index a contiguous array of structs, which slightly favours Rust and Go.

How it is timed. Every binary divides over 4 threads, the count Nish's runtime chooses on this machine: NISH_NUM_THREADS, RAYON_NUM_THREADS, GOMAXPROCS and PAR_THREADS (read by the scope twins) are all set to it. The comparison is run 3 time(s), minutes apart, each run 11 interleaved rounds after 1 warm-up: in each round every binary and a byte-identical copy of it run once, in an order rotated by one per round. The times below are process wall time, min / median in ms over every round of every run. In each run, and separately for the minimum and the median, Nish is divided by the fastest other column on that statistic, and the band is the larger of the gaps between Nish and its copy and between that column and its copy. A ratio reads as faster or slower only outside the band, and within 0.5% of its edge as at the edge. The reading takes every run together: runs that fall on both sides of the band make no claim. The Nish column is the par run of the table above, timed again here beside seven other binaries rather than in that table's alternation with its loop, so the two tables' Nish figures differ by about as much as this machine moves between runs: compare within a table, not across.

Measured on 2026-11-14, on Intel(R) Xeon(R) Processor @ 2.10GHz, 4 logical cores, 4 threads, linux 6.18.44-fc-v470, by node bench/run.mjs --only par at main at f8e21091, the base of the branch it was measured on (branch commit c1d3f06f, which a squash merge does not keep). nish 0.39.0; rustc 1.97.0 (2d8144b78 2026-07-07); Rayon 1.12.0, built by cargo with the same profile; go version go1.24.7 linux/amd64.

Kernel Nish Rust thread::scope Rust Rayon Go Nish / fastest, min, over 3 run(s) Nish / fastest, median Reading, min Reading, median
par-compute 252 / 266 241 / 259 245 / 259 245 / 258 1.024x to 1.055x 1.015x to 1.068x slower outside the band in all 3 runs; within 1.10x in all 3 runs slower outside the band in 2 of 3 runs, within it or at its edge in the rest; within 1.10x in all 3 runs
par-nbody 62.5 / 65.1 54.8 / 60.9 54.1 / 56.4 123 / 131 1.147x to 1.175x 1.135x to 1.156x slower outside the band in all 3 runs; past 1.10x in all 3 runs slower outside the band in all 3 runs; past 1.10x in all 3 runs
par-regions 60.1 / 64.9 133 / 145 70.6 / 86.0 316 / 390 0.794x to 0.851x 0.732x to 0.768x faster outside the band in all 3 runs; within 1.10x in all 3 runs faster outside the band in all 3 runs; within 1.10x in all 3 runs
par-histogram 139 / 225 313 / 384 303 / 392 187 / 213 0.736x to 0.903x 1.006x to 1.081x faster outside the band in all 3 runs; within 1.10x in all 3 runs slower outside the band in 1 of 3 runs, within it or at its edge in the rest; within 1.10x in all 3 runs
par-histogram-atomic 58.1 / 68.9 62.4 / 69.5 60.6 / 69.1 92.0 / 104 0.932x to 1.059x 0.998x to 1.037x slower outside the band in 1 of 3 runs, within it or at its edge in the rest; Nish ahead in 1 of 3 runs, behind in 2 of 3 runs; within 1.10x in all 3 runs slower outside the band in 1 of 3 runs, within it or at its edge in the rest; Nish ahead in 1 of 3 runs, behind in 2 of 3 runs; within 1.10x in all 3 runs

Each run on its own: the fastest other column on each statistic, Nish over it, and that row's band.

Kernel Run Fastest, min Nish / it Band Fastest, median Nish / it Band
par-compute 1 Rust thread::scope 1.024x 0.4% Rust thread::scope 1.015x 1.9%
par-compute 2 Rust thread::scope 1.049x 2.0% Go 1.068x 2.7%
par-compute 3 Rust thread::scope 1.055x 2.9% Rust Rayon 1.036x 2.3%
par-nbody 1 Rust Rayon 1.175x 1.0% Rust Rayon 1.135x 0.3%
par-nbody 2 Rust thread::scope 1.147x 4.0% Rust Rayon 1.156x 2.0%
par-nbody 3 Rust Rayon 1.155x 1.2% Rust Rayon 1.135x 1.0%
par-regions 1 Rust Rayon 0.794x 6.2% Rust Rayon 0.753x 10.2%
par-regions 2 Rust Rayon 0.828x 1.7% Rust Rayon 0.732x 3.8%
par-regions 3 Rust Rayon 0.851x 3.1% Rust Rayon 0.768x 6.0%
par-histogram 1 Go 0.835x 7.7% Go 1.006x 7.7%
par-histogram 2 Go 0.736x 14.2% Go 1.043x 4.9%
par-histogram 3 Go 0.903x 3.7% Go 1.081x 2.0%
par-histogram-atomic 1 Rust Rayon 1.036x 8.5% Rust Rayon 0.998x 5.7%
par-histogram-atomic 2 Rust thread::scope 0.932x 7.4% Rust thread::scope 1.020x 3.0%
par-histogram-atomic 3 Rust Rayon 1.059x 4.5% Rust Rayon 1.037x 3.2%

Rust flags: -C opt-level=3 -C panic=abort -C codegen-units=1 -C strip=symbols --edition 2021, without target-cpu=native or LTO; Nish's --profile speed has no -march either. Go: go build -trimpath -ldflags=-s -w. bench/README.md says what each kernel measures and, where Nish loses, what has been measured of why.

The Checksums and Commands sections below are written by a full run, which --only par leaves as they were, so a kernel added since the last full run is missing there. Every binary of this table printed its kernel's checksum, and was built so:

  • par-compute: 1875749.772460931

    nish build/bench/src/par-compute.ts --link build/bench/par-compute --profile speed
    rustc -C opt-level=3 -C panic=abort -C codegen-units=1 -C strip=symbols --edition 2021 build/bench/src/par-compute.rs -o build/bench/par-compute-rust
    cargo build --release --quiet --manifest-path build/bench/rayon/Cargo.toml
    go build -trimpath -ldflags=-s -w -o build/bench/par-compute-go build/bench/src/par-compute.go
    
  • par-nbody: -534915.1104460816 -536673.7291541903

    nish build/bench/src/par-nbody.ts --link build/bench/par-nbody --profile speed
    rustc -C opt-level=3 -C panic=abort -C codegen-units=1 -C strip=symbols --edition 2021 build/bench/src/par-nbody.rs -o build/bench/par-nbody-rust
    cargo build --release --quiet --manifest-path build/bench/rayon/Cargo.toml
    go build -trimpath -ldflags=-s -w -o build/bench/par-nbody-go build/bench/src/par-nbody.go
    
  • par-regions: 676527561 507283512

    nish build/bench/src/par-regions.ts --link build/bench/par-regions --profile speed
    rustc -C opt-level=3 -C panic=abort -C codegen-units=1 -C strip=symbols --edition 2021 build/bench/src/par-regions.rs -o build/bench/par-regions-rust
    cargo build --release --quiet --manifest-path build/bench/rayon/Cargo.toml
    go build -trimpath -ldflags=-s -w -o build/bench/par-regions-go build/bench/src/par-regions.go
    
  • par-histogram: 56760 3200000

    nish build/bench/src/par-histogram.ts --link build/bench/par-histogram --profile speed
    rustc -C opt-level=3 -C panic=abort -C codegen-units=1 -C strip=symbols --edition 2021 build/bench/src/par-histogram.rs -o build/bench/par-histogram-rust
    cargo build --release --quiet --manifest-path build/bench/rayon/Cargo.toml
    go build -trimpath -ldflags=-s -w -o build/bench/par-histogram-go build/bench/src/par-histogram.go
    
  • par-histogram-atomic: 56760 3200000

    nish build/bench/src/par-histogram-atomic.ts --link build/bench/par-histogram-atomic --profile speed
    rustc -C opt-level=3 -C panic=abort -C codegen-units=1 -C strip=symbols --edition 2021 build/bench/src/par-histogram-atomic.rs -o build/bench/par-histogram-atomic-rust
    cargo build --release --quiet --manifest-path build/bench/rayon/Cargo.toml
    go build -trimpath -ldflags=-s -w -o build/bench/par-histogram-atomic-go build/bench/src/par-histogram-atomic.go
    

Scheduling a divided region

Measured on 2026-10-20 on the machine of the data-parallelism table above (Intel(R) Xeon(R) Processor @ 2.10GHz, 4 logical cores), every figure a median in ms over interleaved rounds in which each binary and a byte-identical copy of it ran once; the copy's gap is the noise band, and a difference inside it is no difference.

nish_parallel_range used to cut a divided region into one contiguous chunk per thread. A thread that was preempted held every other thread at the join. It now cuts the range into up to eight pieces per thread, never smaller than the grain, and each thread claims the next piece with one relaxed fetch_add as it finishes the last; the calling thread runs the first. Eight is the flat middle of a sweep over par-heavy at four threads, nine rounds: 2 pieces per thread was slower and noisier (868, 766–1121), 4 to 32 lay within the copy band (805–822), and so did par-scale's memory-bound map (262–270).

Kernel What main copy this runtime copy
par-heavy, 4 threads, 15 rounds 16 scramble rounds per element, 2^22 elements, 40 calls 846 834 792 771
par-scale, 4 threads x * k, 2^22 elements, 40 calls: memory-bound 277 266 270 260
par-single, 4 threads one x * 3 map over 2^25 elements 213 209 213 207
par-alloc, 4 threads, 9 rounds a string formatted per element, 2^22 elements: the body allocates 88 79 52 51
3 chunks above the grain par-heavy at 600,000 elements, 300 calls: three chunks of the grain 1053 1036 1071 1174
8 chunks above the grain par-heavy at 2^21 elements, 80 calls: eight chunks 843 781 815 787

par-heavy at one thread is 2172 (2108–2315), within main's band. Over that one-thread loop, on the medians of the same rounds, par-heavy goes from about 2.6x on main (2172 / 846) to about 2.7x (2172 / 792), about 6% faster at four threads and outside the copy band (846 / 834 against 792 / 771); the data-parallelism table above, on minima, has 2.91x. par-alloc, whose body allocates, is the largest gain: 79–88 ms on main, 51–52 here, and the gain is the pieces' own: the same runtime with the arena reset between pieces taken out measures 53, the same. par-histogram is a scope of tasks, not a divided region, and its contended lock spreads each binary over 89–258 ms; its medians, 223–229 on main and 199–206 here over 15 rounds, are no difference. The others are unchanged.

A single 2^25 map is not slower than at efbbd8c8 (212 / 211) or on main, and workers touching their own pages first (first-touch) measured within the band, so it is not shipped.

par-heavy does not reach 3x, and the scheduler is not why. Its checksum is an order-sensitive fold over the result, which runs on one thread, and so do the fill and the allocation before the map. Timed with zero scramble rounds, so that the map does nearly nothing, the program takes 252 with the fold and 75 without it: the fold is about 177 ms and the fill, the allocation and the near-empty map about 75, some 286 ms of the 2172 one-thread run (13%).

By Amdahl the best four cores can do is (2172 − 286) / 4 + 286 ≈ 757 ms, a cap of about 2.9x; the program measures about 2.7x on these medians. Inside the region each thread was busy for 500–544 ms of an ideal 471 (87–93% busy efficiency), the region's wall time was 555–591 ms (80–85%), threads started within 1.6–5 ms of each other and finished within 30–60 ms, and each claimed 152–171 pieces.

The fold, not the scheduler, explains main's 2.6x. With the serial part made smaller or the divided part larger, the same map clears 3x on both runtimes: par-heavy-fold, whose fold vectorises, measures about 3.15x, and par-heavy4, with four times the scramble rounds and the same fold, about 3.4x.

Map and Set (WP32)

Each workload is timed by the program around the workload alone, not as process wall time, and every column is its own process, the columns taking turns round by round: 5 timed runs after 1 warm-up, min / median in ms. The workloads are docs/wp32-map.md §2's, over the same keys, and every program prints checksum lines bench/map-node.mjs prints from Node's Map. unordered is the S1 prototype with keys and values in the buckets, the layout the language does not ship; the ratios divide minimums. The programs are built with nish bench/<name>.ts --link <exe> --profile speed, and bench/README.md describes them; §10 of the note reads the numbers.

n = 65,536

(a) the four layout prototypes

workload ordered ordered+i64 fp ordered+u32 fp unordered Node Map u32 fp / unordered u32 fp / Node
insert str 32.4 / 39.8 22.8 / 24.6 17.3 / 20.3 22.2 / 24.7 35.7 / 42.1 0.78x 0.48x
hit str 44.4 / 48.5 34.5 / 39.4 41.7 / 42.7 30.3 / 37.9 94.5 / 105 1.38x 0.44x
miss str 56.8 / 60.0 34.7 / 44.3 35.8 / 40.9 39.5 / 41.6 104 / 131 0.91x 0.35x
count str 13.3 / 15.9 12.7 / 14.1 11.3 / 13.7 13.0 / 13.3 35.8 / 40.7 0.87x 0.32x
churn str 55.0 / 60.4 39.9 / 40.7 32.2 / 40.3 39.7 / 46.7 87.8 / 102 0.81x 0.37x
insert int 14.5 / 15.3 16.2 / 18.3 13.6 / 14.7 15.2 / 17.6 26.0 / 28.4 0.90x 0.52x
hit int 7.98 / 9.05 7.68 / 9.40 7.56 / 8.88 8.15 / 9.97 49.2 / 54.4 0.93x 0.15x
miss int 11.6 / 13.3 10.2 / 11.4 9.47 / 9.83 10.2 / 12.1 44.8 / 54.3 0.93x 0.21x
count int 5.42 / 5.46 4.59 / 4.89 4.47 / 4.80 5.24 / 5.64 34.1 / 40.4 0.85x 0.13x
churn int 28.2 / 29.5 22.0 / 25.2 19.7 / 22.5 30.3 / 30.8 61.6 / 86.8 0.65x 0.32x

(b) word count: fused against double lookup

workload Map fused Map double unordered Node fused Node double double / fused fused / unordered fused / Node fused
count str 13.7 / 15.1 20.3 / 25.2 13.0 / 13.3 51.2 / 57.4 52.3 / 57.4 1.49x 1.05x 0.27x
count int 5.83 / 6.24 8.43 / 9.01 5.24 / 5.64 35.6 / 42.7 37.1 / 41.2 1.45x 1.11x 0.16x

(c) insert: presized with reserve against growing

workload Map growing Map reserve unordered Node growing Node reserve growing / reserve reserve / unordered reserve / Node
insert str 17.3 / 22.0 12.8 / 14.5 22.2 / 24.7 41.6 / 52.6 47.3 / 51.0 1.35x 0.57x 0.31x
insert int 13.6 / 16.7 8.81 / 10.7 15.2 / 17.6 22.3 / 30.3 24.4 / 32.4 1.54x 0.58x 0.39x

Peak RSS of map-presize running one variant alone (whole process, both key sets included): growing 33,644 KB, reserve 29,168 KB.

(d) the global Map against StringMap

workload Map StringMap unordered Node Map Map / StringMap Map / unordered Map / Node
insert str 17.4 / 23.3 18.5 / 19.4 22.2 / 24.7 35.7 / 42.1 0.94x 0.78x 0.49x
hit str 33.9 / 41.3 37.8 / 40.3 30.3 / 37.9 94.5 / 105 0.90x 1.12x 0.36x
miss str 34.5 / 43.5 35.8 / 41.1 39.5 / 41.6 104 / 131 0.96x 0.87x 0.33x
count str 11.8 / 14.2 11.4 / 13.1 13.0 / 13.3 35.8 / 40.7 1.03x 0.90x 0.33x
churn str 32.5 / 34.7 39.7 / 46.7 87.8 / 102 0.82x 0.37x
insert int 13.0 / 13.7 15.2 / 17.6 26.0 / 28.4 0.86x 0.50x
hit int 8.60 / 10.4 8.15 / 9.97 49.2 / 54.4 1.06x 0.17x
miss int 10.9 / 11.4 10.2 / 12.1 44.8 / 54.3 1.07x 0.24x
count int 5.11 / 5.89 5.24 / 5.64 34.1 / 40.4 0.98x 0.15x
churn int 24.7 / 28.0 30.3 / 30.8 61.6 / 86.8 0.81x 0.40x

Of 15 columns by their workloads, 71 cell(s) have a median more than 5% above their minimum: map-proto-ordered on insert str, map-proto-ordered-fp on insert str, map-proto-ordered-fp32 on insert str, map-proto-unordered on insert str, map-node on insert str, map-proto-ordered on hit str, map-proto-ordered-fp on hit str, map-proto-unordered on hit str, map-node on hit str, map-proto-ordered on miss str, map-proto-ordered-fp on miss str, map-proto-ordered-fp32 on miss str, map-proto-unordered on miss str, map-node on miss str, map-proto-ordered on count str, map-proto-ordered-fp on count str, map-proto-ordered-fp32 on count str, map-node on count str, map-proto-ordered on churn str, map-proto-ordered-fp32 on churn str, map-proto-unordered on churn str, map-node on churn str, map-proto-ordered on insert int, map-proto-ordered-fp on insert int, map-proto-ordered-fp32 on insert int, map-proto-unordered on insert int, map-node on insert int, map-proto-ordered on hit int, map-proto-ordered-fp on hit int, map-proto-ordered-fp32 on hit int, map-proto-unordered on hit int, map-node on hit int, map-proto-ordered on miss int, map-proto-ordered-fp on miss int, map-proto-unordered on miss int, map-node on miss int, map-proto-ordered-fp on count int, map-proto-ordered-fp32 on count int, map-proto-unordered on count int, map-node on count int, map-proto-ordered-fp on churn int, map-proto-ordered-fp32 on churn int, map-node on churn int, map-wordcount on count str, map-wordcount on count str, map-wordcount.mjs on count str, map-wordcount.mjs on count str, map-wordcount on count int, map-wordcount on count int, map-wordcount.mjs on count int, map-wordcount.mjs on count int, map-presize on insert str, map-presize on insert str, map-presize.mjs on insert str, map-presize.mjs on insert str, map-presize on insert int, map-presize on insert int, map-presize.mjs on insert int, map-presize.mjs on insert int, map-vs-stringmap on insert str, map-vs-stringmap on hit str, map-vs-stringmap on hit str, map-vs-stringmap on miss str, map-vs-stringmap on miss str, map-vs-stringmap on count str, map-vs-stringmap on count str, map-vs-stringmap on churn str, map-vs-stringmap on insert int, map-vs-stringmap on hit int, map-vs-stringmap on count int, map-vs-stringmap on churn int.

n = 1,048,576

(a) the four layout prototypes

workload ordered ordered+i64 fp ordered+u32 fp unordered Node Map u32 fp / unordered u32 fp / Node
insert str 906 / 986 527 / 549 465 / 472 456 / 560 1265 / 1339 1.02x 0.37x
hit str 1529 / 1710 1300 / 1499 1590 / 1662 1227 / 1401 2667 / 2914 1.30x 0.60x
miss str 2266 / 2483 1448 / 1515 1563 / 1690 1514 / 1602 4430 / 4851 1.03x 0.35x
count str 647 / 790 696 / 719 707 / 765 644 / 674 1783 / 1838 1.10x 0.40x
churn str 1976 / 2042 1036 / 1169 1085 / 1143 1267 / 1302 3063 / 3187 0.86x 0.35x
insert int 344 / 416 405 / 445 323 / 368 335 / 357 635 / 706 0.96x 0.51x
hit int 470 / 508 367 / 393 445 / 486 298 / 354 1679 / 1856 1.50x 0.27x
miss int 499 / 561 403 / 453 442 / 497 359 / 393 1806 / 1908 1.23x 0.24x
count int 176 / 195 159 / 191 205 / 219 168 / 176 834 / 983 1.22x 0.25x
churn int 789 / 828 759 / 782 692 / 727 812 / 977 2263 / 2465 0.85x 0.31x

(b) word count: fused against double lookup

workload Map fused Map double unordered Node fused Node double double / fused fused / unordered fused / Node fused
count str 671 / 726 1269 / 1364 644 / 674 1971 / 2159 1674 / 1790 1.89x 1.04x 0.34x
count int 192 / 244 331 / 354 168 / 176 1073 / 1224 1146 / 1278 1.72x 1.15x 0.18x

(c) insert: presized with reserve against growing

workload Map growing Map reserve unordered Node growing Node reserve growing / reserve reserve / unordered reserve / Node
insert str 389 / 453 298 / 318 456 / 560 1228 / 1360 1245 / 1372 1.31x 0.65x 0.24x
insert int 335 / 377 216 / 232 335 / 357 556 / 626 607 / 640 1.55x 0.64x 0.39x

Peak RSS of map-presize running one variant alone (whole process, both key sets included): growing 510,448 KB, reserve 444,400 KB.

(d) the global Map against StringMap

workload Map StringMap unordered Node Map Map / StringMap Map / unordered Map / Node
insert str 409 / 449 363 / 432 456 / 560 1265 / 1339 1.13x 0.90x 0.32x
hit str 1272 / 1501 1189 / 1466 1227 / 1401 2667 / 2914 1.07x 1.04x 0.48x
miss str 1278 / 1509 1202 / 1585 1514 / 1602 4430 / 4851 1.06x 0.84x 0.29x
count str 761 / 766 617 / 801 644 / 674 1783 / 1838 1.23x 1.18x 0.43x
churn str 1004 / 1109 1267 / 1302 3063 / 3187 0.79x 0.33x
insert int 310 / 350 335 / 357 635 / 706 0.92x 0.49x
hit int 488 / 511 298 / 354 1679 / 1856 1.64x 0.29x
miss int 435 / 522 359 / 393 1806 / 1908 1.21x 0.24x
count int 187 / 239 168 / 176 834 / 983 1.12x 0.22x
churn int 695 / 744 812 / 977 2263 / 2465 0.86x 0.31x

Of 15 columns by their workloads, 64 cell(s) have a median more than 5% above their minimum: map-proto-ordered on insert str, map-proto-unordered on insert str, map-node on insert str, map-proto-ordered on hit str, map-proto-ordered-fp on hit str, map-proto-unordered on hit str, map-node on hit str, map-proto-ordered on miss str, map-proto-ordered-fp32 on miss str, map-proto-unordered on miss str, map-node on miss str, map-proto-ordered on count str, map-proto-ordered-fp32 on count str, map-proto-ordered-fp on churn str, map-proto-ordered-fp32 on churn str, map-proto-ordered on insert int, map-proto-ordered-fp on insert int, map-proto-ordered-fp32 on insert int, map-proto-unordered on insert int, map-node on insert int, map-proto-ordered on hit int, map-proto-ordered-fp on hit int, map-proto-ordered-fp32 on hit int, map-proto-unordered on hit int, map-node on hit int, map-proto-ordered on miss int, map-proto-ordered-fp on miss int, map-proto-ordered-fp32 on miss int, map-proto-unordered on miss int, map-node on miss int, map-proto-ordered on count int, map-proto-ordered-fp on count int, map-proto-ordered-fp32 on count int, map-node on count int, map-proto-unordered on churn int, map-node on churn int, map-wordcount on count str, map-wordcount on count str, map-wordcount.mjs on count str, map-wordcount.mjs on count str, map-wordcount on count int, map-wordcount on count int, map-wordcount.mjs on count int, map-wordcount.mjs on count int, map-presize on insert str, map-presize on insert str, map-presize.mjs on insert str, map-presize.mjs on insert str, map-presize on insert int, map-presize on insert int, map-presize.mjs on insert int, map-presize.mjs on insert int, map-vs-stringmap on insert str, map-vs-stringmap on insert str, map-vs-stringmap on hit str, map-vs-stringmap on hit str, map-vs-stringmap on miss str, map-vs-stringmap on miss str, map-vs-stringmap on count str, map-vs-stringmap on churn str, map-vs-stringmap on insert int, map-vs-stringmap on miss int, map-vs-stringmap on count int, map-vs-stringmap on churn int.

Checksums

Every binary of a benchmark printed the same output (numeric tokens compared to 1e-9 relative):

  • fib (fib(40), recursive calls): 102334155
  • nbody (n-body, 5 bodies, 2e7 steps (class + array, f64)): -0.16907516382852447 -0.16903166455255911
  • spectral (spectral norm, n = 3000 (number[] + f64)): 1.2742241526449527
  • sieve (sieve of Eratosthenes, n = 1e7, 20 passes (boolean[])): 13291580
  • strbuild (string building, 131072 template pieces joined into 806 KB): 806394
  • vec3 (Vec3 class with methods, 5e7 iterations (f64)): 5.0374790893186878 -2.5000002511859338 14.987437525871041 308333374.98446459
  • result (Result<number, number> returned and passed, 2e8 calls (WP17 packing)): 15873
  • par-compute (loop and map): 1875749.772460931
  • par-alloc (loop and map): 2105701356
  • par-nbody (loop and map): -534915.1104460816 -536673.7291541903
  • par-short (loop and map): 4569990
  • par-regions (loop and map): 676527561 507283512

Commands

Sources are copied to build/bench/src/ (with the size substituted when --n is given) and built from the repository root:

fib

nish build/bench/src/fib.ts --link build/bench/fib-nish --profile speed
nish build/bench/src/fib.ts --link build/bench/fib-nish-size --profile size
clang -O3 -s build/bench/src/fib.c -lm -o build/bench/fib-c
rustc -C opt-level=3 -C panic=abort -C codegen-units=1 -C strip=symbols build/bench/src/fib.rs -o build/bench/fib-rust
rustc -C opt-level=3 -C panic=abort -C codegen-units=1 -C strip=symbols -C target-cpu=native build/bench/src/fib.rs -o build/bench/fib-rust-native
go build -trimpath -ldflags=-s -w -o build/bench/fib-go build/bench/src/fib.go

nbody

nish build/bench/src/nbody.ts --number-mode f64 --link build/bench/nbody-nish --profile speed
nish build/bench/src/nbody.ts --number-mode f64 --link build/bench/nbody-nish-size --profile size
clang -O3 -s build/bench/src/nbody.c -lm -o build/bench/nbody-c
rustc -C opt-level=3 -C panic=abort -C codegen-units=1 -C strip=symbols build/bench/src/nbody.rs -o build/bench/nbody-rust
rustc -C opt-level=3 -C panic=abort -C codegen-units=1 -C strip=symbols -C target-cpu=native build/bench/src/nbody.rs -o build/bench/nbody-rust-native
go build -trimpath -ldflags=-s -w -o build/bench/nbody-go build/bench/src/nbody.go

spectral

nish build/bench/src/spectral.ts --number-mode f64 --link build/bench/spectral-nish --profile speed
nish build/bench/src/spectral.ts --number-mode f64 --link build/bench/spectral-nish-size --profile size
clang -O3 -s build/bench/src/spectral.c -lm -o build/bench/spectral-c
rustc -C opt-level=3 -C panic=abort -C codegen-units=1 -C strip=symbols build/bench/src/spectral.rs -o build/bench/spectral-rust
rustc -C opt-level=3 -C panic=abort -C codegen-units=1 -C strip=symbols -C target-cpu=native build/bench/src/spectral.rs -o build/bench/spectral-rust-native
go build -trimpath -ldflags=-s -w -o build/bench/spectral-go build/bench/src/spectral.go

sieve

nish build/bench/src/sieve.ts --link build/bench/sieve-nish --profile speed
nish build/bench/src/sieve.ts --link build/bench/sieve-nish-size --profile size
clang -O3 -s build/bench/src/sieve.c -lm -o build/bench/sieve-c
rustc -C opt-level=3 -C panic=abort -C codegen-units=1 -C strip=symbols build/bench/src/sieve.rs -o build/bench/sieve-rust
rustc -C opt-level=3 -C panic=abort -C codegen-units=1 -C strip=symbols -C target-cpu=native build/bench/src/sieve.rs -o build/bench/sieve-rust-native
go build -trimpath -ldflags=-s -w -o build/bench/sieve-go build/bench/src/sieve.go

strbuild

nish build/bench/src/strbuild.ts --link build/bench/strbuild-nish --profile speed
nish build/bench/src/strbuild.ts --link build/bench/strbuild-nish-size --profile size
clang -O3 -s build/bench/src/strbuild.c -lm -o build/bench/strbuild-c
clang -O3 -s build/bench/src/strbuild-naive.c -lm -o build/bench/strbuild-c-strbuild-naive
rustc -C opt-level=3 -C panic=abort -C codegen-units=1 -C strip=symbols build/bench/src/strbuild.rs -o build/bench/strbuild-rust
rustc -C opt-level=3 -C panic=abort -C codegen-units=1 -C strip=symbols -C target-cpu=native build/bench/src/strbuild.rs -o build/bench/strbuild-rust-native
go build -trimpath -ldflags=-s -w -o build/bench/strbuild-go build/bench/src/strbuild.go

vec3

nish build/bench/src/vec3.ts --number-mode f64 --link build/bench/vec3-nish --profile speed
nish build/bench/src/vec3.ts --number-mode f64 --link build/bench/vec3-nish-size --profile size
clang -O3 -s build/bench/src/vec3.c -lm -o build/bench/vec3-c
rustc -C opt-level=3 -C panic=abort -C codegen-units=1 -C strip=symbols build/bench/src/vec3.rs -o build/bench/vec3-rust
rustc -C opt-level=3 -C panic=abort -C codegen-units=1 -C strip=symbols -C target-cpu=native build/bench/src/vec3.rs -o build/bench/vec3-rust-native
go build -trimpath -ldflags=-s -w -o build/bench/vec3-go build/bench/src/vec3.go

result

nish build/bench/src/result.ts --link build/bench/result-nish --profile speed
nish build/bench/src/result.ts --link build/bench/result-nish-size --profile size
clang -O3 -s build/bench/src/result.c -lm -o build/bench/result-c
rustc -C opt-level=3 -C panic=abort -C codegen-units=1 -C strip=symbols build/bench/src/result.rs -o build/bench/result-rust
rustc -C opt-level=3 -C panic=abort -C codegen-units=1 -C strip=symbols -C target-cpu=native build/bench/src/result.rs -o build/bench/result-rust-native
go build -trimpath -ldflags=-s -w -o build/bench/result-go build/bench/src/result.go

par-compute

nish build/bench/src/par-compute.ts --link build/bench/par-compute --profile speed

par-alloc

nish build/bench/src/par-alloc.ts --link build/bench/par-alloc --profile speed

par-nbody

nish build/bench/src/par-nbody.ts --link build/bench/par-nbody --profile speed

par-short

nish build/bench/src/par-short.ts --link build/bench/par-short --profile speed

par-regions

nish build/bench/src/par-regions.ts --link build/bench/par-regions --profile speed

Rust flags: -C opt-level=3 -C panic=abort -C codegen-units=1 -C strip=symbols, plus -C target-cpu=native for the native column. Go has no optimisation level to choose: -trimpath and -ldflags=-s -w only strip the binary. nish --link runs scripts/build.sh --profile speed (clang -O3 -flto with section GC and stripping; see the README) over the module and runtime/runtime.c.

JSON against other languages

Written by node bench/json-compare/run.mjs --record, not by bench/run.mjs, which carries this section over when it rewrites the file. The run is its own, so the host below may not be the one in the table at the head of this file. The workloads, the checksums and the measurement rules are in that script's header, and the Nish program is main.ts.

The ratio column divides the Nish minimum by that implementation's minimum, as the tables above do: above 1.00x it is faster than Nish. A ratio within the noise band, the gap between Nish and a byte-identical copy of its binary, is marked as no difference.

Builds: Nish --link --profile speed; C clang -O3 -DNDEBUG and C++ clang++ -O3 -DNDEBUG; serde_json cargo --release with LTO and one codegen unit; Go go build.

What differs between the rows:

  • Tokenize is each library's own way of visiting every value. Nish's tokenizer copies every key and string out with stringInto; yyjson builds a whole tree, reading a copy of the input rather than in place; RapidJSON's Reader (SAX) calls back per value; serde_json drives a Visitor; Go's Decoder.Token makes an interface{} per token. simdjson On-Demand materialises every value as it is visited. What must agree: in the timed loop, each token's kind and each key's and string's length and last byte, folded, and the sum of the numbers as a double; in an untimed pass over the last iteration's input, every byte of every key and string.
  • Typed decode has no yyjson or RapidJSON row: neither has a typed layer. Every row decodes into a fresh value each iteration. simdjson On-Demand reads performances and nothing after it, while serde_json, Go and Nish scan the whole document, so simdjson's MB/s divides the whole document's bytes by a time that did not read all of them. The extra Nish row decodes into one value reused across iterations, which nish/json-typed supports and the others' APIs do not. What must agree: every decoded field of every performance, each string byte by byte, folded each iteration.
  • Serialize times the writing alone, from the same decoded values. Nish (jsonEncode) and serde_json (derive) write from the type, Go by reflection (its encoder's trailing newline is trimmed), and simdjson's row is builder calls written by hand, field by field, since simdjson has no type-driven writer without C++26 reflection. What must agree is a 64-bit h * 31 + v fold of every byte of every iteration's output, and the last output's length.
Date 2026-11-14
nish nish 0.39.0 (commit ae459f3a)
CPU Intel(R) Xeon(R) Processor @ 2.30GHz, 4 logical cores
OS linux 6.18.44-fc-v470 (x64)
Toolchains Nish: nish 0.39.0; C++: clang++ Ubuntu clang version 18.1.3 (1ubuntu1); C: clang Ubuntu clang version 18.1.3 (1ubuntu1); Rust: cargo 1.97.0 (c980f4866 2026-06-30), rustc 1.97.0 (2d8144b78 2026-07-07); Go: go go version go1.24.7 linux/amd64
Command npm run build && node bench/json-compare/run.mjs --rounds 9 --mb 128 --record
Runs interleaved rounds, at least 9 and for each case the next multiple of twice its implementations (the round count is in each heading), 128 MB of input per run; ns per document, min and median over the rounds

tokenize, twitter.json (631,514 bytes, 213 per run, 14 rounds)

Checksum tokenize 16249681129112504606 29573 2.1169264482695808e+22 1796848684544597327, the same from every implementation.

Implementation ns/doc min ns/doc median MB/s (min) Nish min / its min
Nish 488,754 514,556 1292 1.00x
simdjson 4.4.2 (On-Demand) 397,763 405,956 1588 1.23x
yyjson 0.12.0 298,636 338,171 2115 1.64x
Nish (byte-identical copy) 490,368 541,475 1288 1.00x, the noise band
RapidJSON (Reader, SAX) 787,629 826,585 802 0.62x
serde_json 1.0.154 791,527 820,429 798 0.62x
Go encoding/json 10,094,757 10,943,168 63 0.05x

Noise band, Nish against its byte-identical copy: 0.3% on the minimums (5.0% on the medians). A ratio within it is no difference.

tokenize, citm_catalog.json (1,727,204 bytes, 78 per run, 14 rounds)

Checksum tokenize 5073453772714654304 85035 26602007581164610 7129887459341653758, the same from every implementation.

Implementation ns/doc min ns/doc median MB/s (min) Nish min / its min
Nish 1,013,559 1,043,560 1704 1.00x
simdjson 4.4.2 (On-Demand) 1,029,713 1,053,169 1677 0.98x
yyjson 0.12.0 845,999 882,038 2042 1.20x
Nish (byte-identical copy) 1,012,232 1,028,592 1706 1.00x, the noise band
RapidJSON (Reader, SAX) 1,091,556 1,176,808 1582 0.93x
serde_json 1.0.154 1,467,095 1,530,979 1177 0.69x
Go encoding/json 15,273,737 17,610,983 113 0.07x

Noise band, Nish against its byte-identical copy: 0.1% on the minimums (1.5% on the medians). A ratio within it is no difference.

tokenize, canada.json (2,251,051 bytes, 60 per run, 14 rounds)

Checksum tokenize 388743233009497152 223236 -75931866.53303604 7819388002301591291, the same from every implementation.

Implementation ns/doc min ns/doc median MB/s (min) Nish min / its min
Nish 3,334,298 3,558,195 675 1.00x
simdjson 4.4.2 (On-Demand) 5,209,894 5,319,817 432 0.64x
yyjson 0.12.0 2,480,419 2,787,867 908 1.34x
Nish (byte-identical copy) 3,342,969 3,471,987 673 1.00x, the noise band
RapidJSON (Reader, SAX) 7,284,879 7,695,373 309 0.46x
serde_json 1.0.154 5,105,024 5,385,577 441 0.65x
Go encoding/json 52,572,678 55,677,487 43 0.06x

Noise band, Nish against its byte-identical copy: 0.3% on the minimums (2.5% on the medians). A ratio within it is no difference.

typed, citm_catalog.json (1,727,204 bytes, 78 per run, 10 rounds)

Checksum typed 13164840133002388121 243, the same from every implementation.

Implementation ns/doc min ns/doc median MB/s (min) Nish min / its min
Nish 1,431,359 1,481,804 1207 1.00x
simdjson 4.4.2 (On-Demand; reads only performances, MB/s over the whole document) 536,564 563,101 3219 2.67x
Nish (byte-identical copy) 1,442,358 1,526,407 1197 0.99x, the noise band
serde_json 1.0.154 1,645,164 1,704,211 1050 0.87x
Go encoding/json 11,117,894 11,915,532 155 0.13x

Noise band, Nish against its byte-identical copy: 0.8% on the minimums (2.9% on the medians). A ratio within it is no difference.

typed-reuse, citm_catalog.json (1,727,204 bytes, 78 per run, 12 rounds)

Checksum typed 13164840133002388121 243, the same from every implementation.

Implementation ns/doc min ns/doc median MB/s (min) Nish min / its min
Nish, decoding into the same objects 1,115,022 1,191,673 1549 1.00x
Nish (byte-identical copy) 1,111,720 1,135,437 1554 1.00x, the noise band

Noise band, Nish against its byte-identical copy: 0.3% on the minimums (5.0% on the medians). A ratio within it is no difference.

serialize, citm_catalog.json (452,530 bytes written, 297 per run, 10 rounds)

Checksum serialize 18100868296888812225 452530, the same from every implementation.

Implementation ns/doc min ns/doc median MB/s (min) Nish min / its min
Nish 371,677 408,184 1218 1.00x
simdjson 4.4.2 (builder::string_builder, written by hand field by field) 141,025 150,054 3209 2.64x
Nish (byte-identical copy) 362,799 375,235 1247 1.02x, the noise band
serde_json 1.0.154 255,315 276,942 1772 1.46x
Go encoding/json 637,170 663,341 710 0.58x

Noise band, Nish against its byte-identical copy: 2.4% on the minimums (8.8% on the medians). A ratio within it is no difference.

Held-out payloads

Instructions per document (callgrind, bench/json-compare/main.ts tokenize --profile speed), the tokenizer before the JSON tokenize-gap work against after it. The three payloads are not in the corpus the work was tuned on: metrics (about 1 MB of numbers) and api (about 1 MB of records with some non-ASCII text) come from a seeded generator, and small is the 242-byte body of bench/json-tokenizer. Their SHA-256 hashes are pinned in bench/json-compare/heldout.mjs, which also writes them. The base is f8e21091, built by scripts/bootstrap.sh in a worktree of that commit; current is fb4b625e (#1588, #1590 and #1600 merged). The record above was taken at ae459f3a, which is fb4b625e plus bench/json-compare/heldout.mjs and nothing else, so it measures the same compiler, std/ and runtime. Both compile the same main.ts with --profile speed. The checksum line is equal for every pair, so both tokenize the same tokens. The base build's src/ differs from main's by about 20 lines in three files.

Payload Base Ir/doc Current Ir/doc Change
metrics 55,219,452 43,961,649 -20.4%
api 20,944,037 17,410,464 -16.9%
small 12,794 11,952 -6.6%

Reproduce: node bench/json-compare/heldout.mjs --base <base build>/build/nish. No comparator rows are missing from the record above: simdjson, yyjson, RapidJSON, serde_json and Go all ran.

JsonWriter's byte writers

JsonWriter.keyBytes and stringBytes copy runs of plain bytes with the skipJsonPlain kernel (nish/bytes) from 16 bytes up. jsonEncode writes strings through jsonWriterPutString, which did not change, so the serialize table above does not measure this: in an A/B against the base, 804120e, serialize on citm ran 0.988x at the minimum, 0.9 points past that run's 0.3% band (the branch against its byte-identical copy). Re-run against 3dca351 with the class kernels' loops restored to main's instructions, it ran 0.988x again, inside that run's 1.4% band. In the same run (12 rounds, minimums, each band the branch against its byte-identical copy), tokenize ran 1.025x on twitter (band 0.7%), 0.994x on citm (0.5%) and 1.048x on canada (0.3%), typed decode on citm 1.003x (0.9%) and typed-reuse 0.955x (4.2%), and bench/json-tokenizer's 242-byte body ran 0.99x, inside its 0.6% band.

Two rows are past their bands: tokenize on citm by 0.1 points and typed-reuse by 0.3 points. Both run machine code identical to main's — the class paths' instructions are main's, and neither workload writes — and in typed-reuse the branch's byte-identical copy ran within 0.3% of the base, so the copy band is the evidence for reading both as noise; none of these gaps, faster or slower, is claimed.

JsonDocument.write, the in-tree caller of the byte writers, ran 1.49x faster on twitter.json and 1.03x to 1.07x on citm_catalog.json at the minimum (12 and 10 interleaved rounds; bands against a byte-identical copy 0.4% and 2.7%). canada.json also ran faster, but a build with the kernel switched off did as well, so that gain is code shape, not the kernel.

On citm, the escape scan does not make serialize faster outside its band: most strings are shorter than 16 bytes, and its ceiling at the 16-byte guard, 1.0139x, is inside the 1.4% band by 0.01 points. The profile, the guard and the full A/B are in wp38-simd.md, JsonWriter's byte writers.

jsonEncode's keys, one pre-escaped copy

jsonEncode of a class writes each key with JsonWriter.keyQuoted: the compiler quotes and escapes the key once, at compile time, into a string constant ("name":), and the writer copies it in one go after the comma and indent. Before, every key went through the same escape scan as a runtime string. JsonWriter.i32 and i64 also count their digits by compares rather than divides. The output is byte-identical.

Instructions per document under callgrind: citm_catalog.json 14.13M → 10.74M (−24.0%); bench/json-api's page of twenty users 188,879 → 162,647 (−13.9%). After the change, keyQuoted is about a quarter of either profile, JsonWriter.i64 31% of citm's, and jsonWriterPutString (escaping the string values) a third of the API page's.

Wall clock, against main at f8e21091. In bench/json-compare, serialize on citm ran 548,213 and 554,908 ns/doc at the minimum in two runs, against main's 767,648 (1.38x to 1.40x at the minimum). The bands, each the build against its byte-identical copy on the minimums, were 8.8%, 5.8% and 0.2%. In node bench/json-api/run.mjs --base <main's nish> (18 interleaved rounds), the page took 8,676 against 11,149 ns at the minimum (1.29x) and 9,710 against 11,856 ns at the median (1.22x); the noise band, main against its own copy, was 2.3% on the minimums and 1.6% on the medians.

Main's profile before the change, and the re-measure

The claim was that the escape scan of each key and the writer's per-key state checks were the largest cost per field in typed serialize. The by-function profile of main just before the change, d822c60d (e966fbe5^), confirms it on both workloads. On citm_catalog.json key writing is 35.0% of the instructions per document, against JsonWriter.i64's 30.5%, a close second. On bench/json-api's page it is 33.1%, against string values' 30.9%. The escape scan is most of it: 30.7% of citm's total and 25.8% of the page's. The state checks, with the comma and colon bytes that key writes, are the rest: 4.3% and 7.3%.

Each group's Ir/doc and share of the whole run. The share of the run includes the harness's checksum fold. The fold runs over the output after the timed region and is the same code in both builds.

citm_catalog.json Before (d822c60d) Share After (e966fbe5) Share
Key writing: escape scan (jsonWriterPutString called for keys) 4,335,399 30.73% — —
Key writing: state checks and separators (JsonWriter.key self plus its lines inlined in the loop) 601,146 4.26% — —
Key writing: JsonWriter.keyQuoted — — 2,704,943 25.31%
Numbers: JsonWriter.i64 (digits inlined) 4,301,426 30.49% 3,321,628 31.08%
String values: JsonWriter.string, jsonEncodeStringOrNull 173,583 1.23% 173,583 1.62%
Checksum fold (harness, outside the clock) 2,602,071 18.44% 2,602,070 24.34%
Rest: brackets, value checks, the generated encoder, inlined byte writes 2,094,487 14.85% 1,886,323 17.65%
Total 14,108,112 100% 10,688,547 100%
bench/json-api page Before (d822c60d) Share After (e966fbe5) Share
Key writing: escape scan (jsonWriterPutString called from key) 48,620 25.77% — —
Key writing: state checks and separators (JsonWriter.key self) 13,852 7.34% — —
Key writing: JsonWriter.keyQuoted — — 38,143 23.52%
String values: JsonWriter.string inclusive 58,342 30.92% 58,342 35.98%
Numbers: JsonWriter.i32 and i64 10,721 5.68% 8,188 5.05%
Checksum fold (harness, outside the clock) 39,951 21.17% 39,951 24.64%
Rest: the generated encoder, boolean, brackets, memcpy 17,219 9.12% 17,545 10.82%
Total 188,705 100% 162,169 100%

Shares are rounded, so the after column for the page sums to 100.01%. Without the fold, key writing was 42.9% of citm's encode and 42.0% of the page's. Key writing is a lower bound on citm. The byte writes the loop inlines are shared with values and brackets and are counted in "Rest".

Every key went through the scan. Per citm document, the before build calls jsonWriterPutString 24,444 times: 17,370 calls from key inlined in the loop, 6,723 from the out-of-line JsonWriter.key, and 351 from JsonWriter.string. The after build calls keyQuoted 24,093 times (17,370 + 6,723) and jsonWriterPutString only from string. The page writes 326 keys and 207 string values, and the after build never takes keyQuoted's fallback to key.

The shares are from builds with -g, so that inlined lines carry their function's name. Their Ir/doc is within 0.5% of the stripped builds (−0.18%, −0.47%, −0.09% and −0.29%). The Ir/doc figures below are from the stripped builds, re-measured in this run against #1592's:

Workload Build Totals (callgrind) Ir/doc #1592 Difference
citm d822c60d N=1 43,038,361; N=10 170,241,812 14,133,717 14.13M +0.03%
citm e966fbe5 N=1 39,643,444; N=10 136,291,985 10,738,727 10.74M −0.01%
json-api d822c60d N=200 38,120,381; N=2000 378,102,615 188,879 188,879 0
json-api e966fbe5 N=200 32,873,981; N=2000 325,638,601 162,647 162,647 0

The change is −24.02% on citm and −13.89% on the page, which matches #1592. The difference columns compare #1592's rounded figures. Ir/doc is (Ir(N_hi) − Ir(N_lo)) / (N_hi − N_lo), the method of heldout.mjs.

Both builds print the same serialize checksum on citm at 297 iterations, the bench's count for a 452,530-byte document: serialize 18100868296888812225 452530. The page's checksum line is also equal between builds at 200, 1000 and 2000 iterations (checksum 15878354662562373591 bytes 6931 at 1000).

Toolchain: x86_64 (Xeon @ 2.10GHz), valgrind-3.22.0, Ubuntu clang/LLVM 18.1.3, node v22.23.4. Each compiler was built by scripts/bootstrap.sh from seed 0.39.0 in a worktree of its commit. Both builds compile bench/json-api/main.ts as it is at e966fbe5, which is identical to main's. Reproduce, in each worktree:

node bench/json-compare/fetch.mjs   # the corpus
./build/nish bench/json-compare/main.ts -o out/ --link citm-main --profile speed   # add -g for the by-function shares
./build/nish <e966fbe5's bench/json-api/main.ts> -o out/ --link api-main --profile speed
valgrind --tool=callgrind --callgrind-out-file=citm-N.out out/citm-main serialize bench/json-compare/cache/corpus/citm_catalog.json N -1   # N = 1, 10; 297 for the checksum
valgrind --tool=callgrind --callgrind-out-file=api-N.out out/api-main N                                                              # N = 200, 2000
callgrind_annotate --inclusive=yes citm-10.out    # and --tree=caller for call counts

JsonDocument's source ranges

JsonDocument.parseRanged and parseTextRanged record each value's and each member key's byte range (about 20 bytes more a value); parse and parseText record none. Retired instructions under cachegrind, from one run of node bench/json-value/measure.mjs --instructions --before <main's nish> against main at 1391cf8, in bench/run.mjs's pinned environment (fixed libc tunables, NISH_SIMD=base, a fixed hash key), 16 MB of input a case. head is this tree's plain parse loop, before main's build of the same program, on the same loop calling parseRanged, and both one parseRanged followed by the plain parse loop in one binary. Every binary is also counted as a byte-identical copy; the band is the gap between the two counts.

Row before head head − before head / before on / head both / head band
parse twitter.json (27 parses) 753,801,566 753,801,541 −25 −0.000% +4.089% +3.749% 0.000%
parse citm_catalog.json (10 parses) 411,471,288 411,471,271 −17 −0.000% +9.427% +10.998% 0.000%
parse canada.json (7 parses) 1,015,203,067 1,015,203,048 −19 −0.000% +10.416% +16.239% 0.000%
parse sample.json, 1,427 bytes (11,757) 1,091,940,938 1,091,929,215 −11,723 −0.001% +7.603% −0.146% 0.000%
builders (500 documents of 1,100 values) 882,996,248 881,763,264 −1,232,984 −0.140% 0.000%
json-compare tokenize twitter.json 353,787,664 353,787,664 0 +0.000% 0.000%
json-compare tokenize citm_catalog.json 297,763,836 297,763,822 −14 −0.000% 0.000%
json-compare tokenize canada.json 993,834,293 993,834,293 0 +0.000% 0.000%
json-compare typed 306,561,355 306,561,383 +28 +0.000% 0.000%
json-compare typed-reuse 303,863,883 303,863,883 0 +0.000% 0.000%
http1-server /json-echo-doc, 2,000 POSTs 161,803,094 161,801,102 −1,992 −0.001% 0.000%

No row retires more than main's but typed, by 28 instructions in 306 million, which is inside what the two byte-identical copies of the same binary differ by in this run (head-copy counts 1 more, before-copy 29 more); the tokenize and typed binaries do not reach nish/json-value. A plain parse writes no range and resets none: ranges carry the generation they were written in and the readers answer -1 for any other, so clear steps the generation as main's does, with one store more, of the range stamp, on the one clear in 511 that wraps it; and a document that never keeps ranges never makes their arrays.

parseRanged costs 4.1% to 10.4% more than parse on the four documents. A binary that links both entry points (both) pays for the second in its plain parse loop, 3.7% to 16.2% on the large documents and −0.15% on sample.json, from layout and inlining rather than noise: every band is 0.000%.

parseRanged keeps its own copies of storeSource, duplicateKeys and sortPending, so that a second caller does not keep them from inlining into parse. append, which every builder goes through, moves a full container's key ranges only when the slots have some of this generation, and reads the range arrays directly there, so that the move inlined into append keeps its not-full path straight. No timings are recorded: unpinned wall-clock bands on this machine ran 2% to 8%, wider than every gap above.

TechEmpower json and plaintext

Measured by bash bench/techempower/run.sh (3 interleaved rounds of 10 s, every contestant started afresh and warmed for 1 s before each count), and copied here from the report it writes to build/tfb/results.md. bench/run.mjs carries this section over between its techempower markers when it rewrites the file. The entry is bench/techempower/: one pollWait loop on Http1Server, run here as one process: pinned to one CPU, it starts one worker (the multi-core figures are below). The other rows are the HTTP twins of bench/http-twins/, each run as its own serve <port>.

entry-copy is a second build of the same main.ts that cmp finds byte-identical, so the gap between entry and entry-copy is the noise band every other difference is read against. entry-nodelay0 is entry started with its nodelay argument 0, so its accepted sockets keep Nagle on. A cell marked * had non-2xx answers or socket errors in at least one round; n/a is a cell no round gave a figure for.

Date 2026-10-21
nish nish 0.18.0 (commit 5ee6e7c), --link --profile speed
CPU Intel(R) Xeon(R) Processor @ 2.80GHz, 4 logical cores
OS linux 6.18.44-fc-v139 (x64)
Client wrk 4.1.0, -t 3, TFB's request headers, --timeout 8; /plaintext through bench/techempower/pipeline.lua 16 deep
Pinning server on CPU 0, wrk on CPUs 1-3. Client-shared: wrk and the server share one 4-core machine, so three cores drive one server core, and a server faster than wrk can drive shows wrk's ceiling
Limits ulimit -n 20000, net.core.somaxconn 4096; no concurrency was clamped
Command npm run build && bash bench/http-twins/build.sh && bash bench/techempower/run.sh --nodelay-compare

/plaintext, 16 requests pipelined per write (req/s, median (min) of 3 rounds of 10 s)

contestant 256 1024 4096 16384
entry 324166 (319907) 324456 (324285) 306716 (296701) 290467 (284270)*
entry-copy 320784 (316919) 328966 (309659) 308748 (303939) 291601 (290158)*
entry-nodelay0 317747 (312271) 322970 (318831) 303926 (303679) 291348 (290808)*
node-http 29737 (29520)* 29450 (29265)* 29925 (29106)* 26138 (24751)*
uws 411621 (405082) 377199 (359682) 369473 (347216) 357901 (295125)*
bun 53993 (52627) 54195 (54139) 49886 (49713) 39482 (38656)*
bun-elysia 50428 (49401) 50386 (47146) 46937 (46735)* 38568 (38178)*
bun-hono 37604 (36408) 36286 (35885) 35372 (34773)* 29819 (29547)*
go-nethttp 29988 (29907) 30094 (29444) 28472 (28105) 23476 (22629)*
go-fasthttp 380231 (373654) 362980 (352041) 351528 (329322) 264089 (243905)
rust-hyper 92857 (85787) 95238 (89832) 83175 (82831) 73213 (70509)*
rust-actix 11147 (11137) 9984 (9926)* 5632 (5234)* n/a
nginx 45752 (44803) 44026 (41499)* 40947 (38162)* 35030 (32098)*

Noise band, the entry against its byte-identical copy (medians): 256 connections: 1.0%, 1024 connections: 1.4%, 4096 connections: 0.7%, 16384 connections: 0.4%.

/json, one request at a time (req/s, median (min) of 3 rounds of 10 s)

contestant 16 32 64 128 256 512
entry 62677 (59149) 72154 (66485) 82974 (78773) 87850 (82665) 89032 (88021) 80449 (70347)
entry-copy 61788 (61021) 70884 (67521) 80291 (79190) 87979 (82959) 88850 (76368) 75596 (55806)
entry-nodelay0 62789 (57984) 71644 (71376) 81762 (77200) 81259 (79262) 81718 (68711) 83571 (52003)
node-http 21051 (20350) 21369 (20080) 20733 (19417) 18293 (18112) 17583 (17384) 17413 (16445)
uws 55513 (54228) 63101 (60259) 73301 (72606) 76345 (73065) 67375 (62743) 70785 (66658)
bun 34751 (34672) 37962 (37266) 42414 (41711) 41895 (38471) 35382 (34501) 32606 (31723)
bun-elysia 34554 (33326) 38334 (37002) 41400 (40724) 41835 (40572) 36276 (31920) 31982 (31845)
bun-hono 28308 (28000) 30410 (29293) 30219 (29872) 30276 (30013) 27538 (26989) 25092 (23765)
go-nethttp 25932 (25363) 26472 (26460) 25951 (24978) 23351 (21753) 21748 (20729) 21274 (20467)
go-fasthttp 43493 (43064) 48007 (46893) 48959 (48237) 43228 (41587) 39086 (38392) 37435 (36700)
rust-hyper 51113 (50772) 56249 (56148) 63765 (61338) 60668 (59596) 53256 (53150) 51512 (49381)
rust-actix 10442 (10417) 10283 (9701) 10257 (9928) 10003 (9846) 10126 (10083) 10024 (9986)
nginx 47409 (44830) 53393 (52078) 59472 (58763) 58394 (58388) 53957 (53930) 53881 (52525)

Noise band, the entry against its byte-identical copy (medians): 16 connections: 1.4%, 32 connections: 1.8%, 64 connections: 3.2%, 128 connections: 0.1%, 256 connections: 0.2%, 512 connections: 6.0%.

What the rows say, read against that band:

  • The twins answer /json with {"message":"Hello, World!","n":<n>}: 8 bytes more than the entry's {"message":"Hello, World!"}, and a counter. The entry serializes its body with a JsonWriter on every request, as TFB requires; the twins vary in how they build theirs.
  • One core of the entry serves /plaintext at medians of 290,467 to 324,456 req/s across every concurrency: below uws everywhere, below go-fasthttp from 256 to 4096 connections, and above every other twin. At 16384 go-fasthttp falls to 264,089, 9.1% under the entry's 290,467 and outside that level's 0.4% band.
  • On /json the entry leads every twin at every concurrency by more than the band. Its narrowest lead is over uws at 16 connections, 62,677 against 55,513 (11.4%, where the band is 1.4%); the widest band, 6.0% at 512, is under its 12.0% lead there (80,449 against 70,785).
  • At 16384 connections wrk reported read errors (connections reset) against every Nish build: the entry in two of its three rounds (250 and 2,452), the copy in two (2,916 and 1,517), and entry-nodelay0 in two (2,075 and 4,418). Several twins had read errors or timeouts there too, and the * marks them.
  • rust-actix answers about 10,000 req/s up to 1024 connections, falls to 5,632 at 4096 with timeouts in every round, and has no figure at 16384: in all three rounds wrk reported 0.00 req/s and no socket errors, so the cell is n/a. An earlier run of this section recorded that cell as 0, which was the failed measurement rather than a rate. Run alone, the twin shows 6.4 ms of latency per request too, so its figures are its own, reported as measured.
  • TCP_NODELAY (WP39 E2, tcpListenFlags flag 2) is the entry's default. Against entry-nodelay0 it is faster outside the band at four levels (/plaintext 256 connections by 2.0% against a 1.0% band, and 4096 by 0.9% against 0.7%; /json 128 by 7.5% against 0.1%, and 256 by 8.2% against 0.2%) and within the band at the other six, slower outside it at none. So the flag stays on.
  • The benchmarked build is 5ee6e7c. The head adds only the listener's pause when an accept runs out of descriptors, which this run never reached: with ulimit -n at 20000, no accept failed for want of one.

One process against one worker a core (WP39 E5)

main.ts takes a fifth argument, its workers: 0, the default, runs one worker a CPU under nish/net/prefork on one SO_REUSEPORT port; 1 runs the one process the tables above measure. run.sh --cores-compare times both from the same build. entry and entry-copy are the byte-identical pair started with workers 1, and so give the noise band. entry-cores is entry started with workers 0. The server gets CPUs 0-1, so entry-cores runs two pinned workers, and wrk gets CPUs 2-3. These figures are not comparable with the one-core tables above: they come from a different machine, build and pinning.

Date 2026-11-12
nish nish 0.38.0 (commit a15917f), --link --profile speed
CPU Intel(R) Xeon(R) Processor @ 2.10GHz, 4 logical cores (a cloud VM)
OS linux 6.18.44-fc-v378 (x64)
Client wrk 4.1.0, -t 2, TFB's request headers, --timeout 8; /plaintext through pipeline.lua 16 deep
Pinning server on CPUs 0-1, wrk on CPUs 2-3. Client-shared: two wrk cores drive two server cores
Limits ulimit -n 20000, net.core.somaxconn 4096; no concurrency was clamped
Command npm run build && bash bench/techempower/run.sh --cores-compare

/plaintext, req/s, median (min) of 3 rounds of 10 s:

contestant 256 1024 4096 16384
entry 1359317 (1309460) 1170871 (901448) 964963 (941896) 888618 (786206)*
entry-copy 1287849 (1122980) 1235716 (1228138) 933724 (875067) 1020255 (858148)
entry-cores 2716939 (2684038) 2570961 (2524748) 2253033 (2192759) 1689248 (1649006)

Noise band (medians): 5.3%, 5.5%, 3.2%, 14.8%. entry-cores against entry: +99.9%, +119.6%, +133.5%, +90.1%, each outside its band.

/json, req/s, median (min) of 3 rounds of 10 s:

contestant 16 32 64 128 256 512
entry 128488 (124765) 141208 (138229) 155871 (145938) 160087 (157302) 167444 (167011) 196739 (185709)
entry-copy 126916 (124397) 141923 (139049) 152071 (141611) 157385 (149838) 170613 (169851) 191569 (172509)
entry-cores 248324 (240201) 272422 (258128) 284092 (272414) 306074 (299083) 321831 (318143) 341548 (328258)

Noise band (medians): 1.2%, 0.5%, 2.4%, 1.7%, 1.9%, 2.6%. entry-cores against entry: +93.3%, +92.9%, +82.3%, +91.2%, +92.2%, +73.6%, each outside its band.

  • Two workers on two cores serve 1.7 to 2.3 times the one process at every concurrency. A gain above 2x, as on /plaintext at 1024 and 4096, is not explained by these runs. One unmeasured hypothesis: the one process is not pinned inside its two CPUs, so it pays for migrations the pinned workers do not.
  • The gain shrinks at the top concurrencies: 16384 on /plaintext and 512 on /json. Two wrk cores are likely the ceiling there, since this machine is client-shared.
  • At /plaintext 16384, entry had 4,679 read errors (connections reset) in one round, which the * marks. The 14.8% band at that level is wide, but the +90.1% gain is several times larger.
  • The peak RSS run.sh reads for entry-cores (1.9 MiB) is the supervisor's alone, so it is left out of these tables. The one process peaked at 91 MiB on /plaintext and 3.1 MiB on /json.
  • The TechEmpower image runs one worker per core of the machine (nish.dockerfile). TFB's own servers have more cores than this VM, so these figures say only that the second core pays off here.

TechEmpower: the async entry against the explicit one (WP49 stage 6)

WP49's gate: the TechEmpower entry written in the async style must stay inside the noise band of the same entry written in the explicit style, on plaintext, json and db. Measured by bash bench/techempower/run.sh, which times async-main.ts beside main.ts and its byte-identical copy, and async-db-main.ts beside db-main.ts and its byte-identical copy on all five database tests, and copied here from build/tfb/results.md. The band is the gap between each pair of identical builds' medians, from the same run. Every contestant pair is started with the same arguments: one process, the same slots, one worker and 4 Postgres connections for the database entries.

This is a relative A/B on one machine, not a TechEmpower rank. wrk, Postgres and the server share one 4-core VM, so the figures record their contention as well as the server; D6 stands, and nothing here is a public number. The cells are req/s, median (minimum) of 3 interleaved rounds of 10 s, each contestant started afresh and warmed for 1 s. Peak RSS is the server's VmHWM from /proc, the largest over every round and concurrency of the test (for /plaintext that is 16384 connections' buffers). A * is a cell with non-2xx answers or socket errors in a round, listed after the tables. wrk counts a non-2xx answer in its rate, so a * figure may be inflated by fast failures; the verdict line marks it * and never calls it inside. The database is loaded once and not reset between contestants or rounds, so /updates, which rewrites world in place, leaves later measurements more dead tuples than earlier ones; the rotated order spreads that across the contestants, and the explicit entry, whose /updates rate is more than twice the async entry's, adds more of them. That count is inferred from the req/s figures; the updates were not counted.

Date 2026-11-10
nish build/nish at da6472d (nish 0.37.0 sources), --link --profile speed
CPU Intel(R) Xeon(R) Processor @ 2.10GHz, 4 logical cores, 15 GiB
OS linux 6.18.44 (x64)
Postgres 16, a throwaway cluster in build/tfb/pg, fsync=off, TFB's world (10,000 rows) and fortune tables
Client wrk 4.1.0, TFB's request headers, --timeout 8; /plaintext through bench/techempower/pipeline.lua 16 deep
Pinning plaintext and json: server on CPU 0, wrk -t 3 on CPUs 1-3. Database: server on CPU 0, Postgres on CPU 1, wrk -t 2 on CPUs 2-3
Command npm run build && PG_BIN=/usr/lib/postgresql/16/bin bash bench/techempower/run.sh

This is the first measurement, kept as the before; the re-measurement after the serve and pool fixes follows it.

Outcome: the gate is not met. The async entry is outside the band at every plaintext concurrency (about 87–90% slower), at five of six json concurrencies (1.5–12.4% slower, inside only at 256), and on every database test except cached-queries at 256 connections (42–91% slower).

/plaintext, req/s, median (min) of 3 round(s) of 10 s

contestant 256 1024 4096 16384 peak RSS, MiB
entry 1275254 (1266198) 958163 (921148) 858381 (811445) 1046566 (997454) 91.2
entry-copy 1044000 (1007521) 962193 (865760) 844607 (818278) 1019847 (826073) 91.2
async 131443 (129364) 123662 (121840) 114719 (108549) 134387 (124264)* 91.5

noise band (|entry - entry-copy| / entry, medians): 256: 18.1% 1024: 0.4% 4096: 1.6% 16384: 2.6%

The 18.1% at 256 connections is more likely a bias than noise: the entry's minimum (1,266,198) is above the copy's median (1,044,000), so the two builds did not overlap at all in that cell. It was not re-run. The async verdict there does not depend on it: −89.7% is outside any band the other concurrencies give.

async vs entry (median delta, inside or outside the band; * had failures, never inside): 256: -89.7% outside 1024: -87.1% outside 4096: -86.6% outside 16384: -87.2% outside*

/json, req/s, median (min) of 3 round(s) of 10 s

contestant 16 32 64 128 256 512 peak RSS, MiB
entry 119805 (119324) 142373 (141393) 161906 (161154) 183656 (175591) 174762 (153722) 183439 (149718) 3.0
entry-copy 121261 (118898) 141907 (141559) 162126 (158489) 184828 (182441) 192535 (177205) 198120 (193308) 3.0
async 108080 (106698) 129808 (129326) 150091 (149321) 160894 (159574) 172115 (169778) 161971 (152284) 3.3

noise band (|entry - entry-copy| / entry, medians): 16: 1.2% 32: 0.3% 64: 0.1% 128: 0.6% 256: 10.2% 512: 8.0%

async vs entry (median delta, inside or outside the band; * had failures, never inside): 16: -9.8% outside 32: -8.8% outside 64: -7.3% outside 128: -12.4% outside 256: -1.5% inside 512: -11.7% outside

The one inside cell, 256 connections, rests on a 10.2% band whose two identical builds did not overlap: the copy's minimum (177,205) is above the entry's median (174,762). Like /plaintext at 256, that band is more likely a bias than noise, and against the 0.1–1.2% the other concurrencies give, −1.5% would not be read as inside. It was not re-run.

Database tests: server on CPU 0, Postgres on CPU 1, client on CPUs 2-3; client wrk -t 2; one worker and 4 Postgres connections each

/db, req/s, median (min) of 3 round(s) of 10 s

contestant 16 64 256 peak RSS, MiB
db-entry 20326 (19700) 109706 (108760) 123345 (116395) 65.6
db-entry-copy 20560 (18952) 112073 (111557) 119804 (119339) 65.5
async-db 11775 (11368) 10993 (10842) 11703 (11593)* 20.7

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 1.2% 64: 2.2% 256: 2.9%

async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: -42.1% outside 64: -90.0% outside 256: -90.5% outside*

/queries?queries=20, req/s, median (min) of 3 round(s) of 10 s

contestant 16 64 256 peak RSS, MiB
db-entry 21639 (21591) 23447 (23288) 31170 (30861) 66.1
db-entry-copy 22181 (21716) 23052 (22068) 31868 (30881) 66.1
async-db 7499 (7302) 7691 (7661) 7894 (7465)* 20.7

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 2.5% 64: 1.7% 256: 2.2%

async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: -65.3% outside 64: -67.2% outside 256: -74.7% outside*

/updates?queries=20, req/s, median (min) of 3 round(s) of 10 s

contestant 16 64 256 peak RSS, MiB
db-entry 6435 (5654) 6431 (6402) 7379 (7296) 66.1
db-entry-copy 6646 (6407) 6310 (6273) 7322 (7236) 66.1
async-db 2899 (2715) 2840 (2817)* 2861 (2768)* 20.8

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 3.3% 64: 1.9% 256: 0.8%

async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: -54.9% outside 64: -55.8% outside* 256: -61.2% outside*

/fortunes, req/s, median (min) of 3 round(s) of 10 s

contestant 16 64 256 peak RSS, MiB
db-entry 59518 (57267) 73954 (73938) 76393 (73169) 65.5
db-entry-copy 59405 (55738) 76434 (71716) 75622 (73414) 65.5
async-db 24117 (23662) 25000 (24372) 22867 (22212)* 20.7

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 0.2% 64: 3.4% 256: 1.0%

async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: -59.5% outside 64: -66.2% outside 256: -70.1% outside*

/cached-queries?count=100, req/s, median (min) of 3 round(s) of 10 s

contestant 16 64 256 peak RSS, MiB
db-entry 61245 (59151) 67384 (65401) 62288 (60071) 65.3
db-entry-copy 61313 (60574) 67514 (65776) 63585 (56958) 65.3
async-db 53879 (52085) 63461 (63078) 62299 (60975) 12.1

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 0.1% 64: 0.2% 256: 2.1%

async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: -12.0% outside 64: -5.8% outside 256: +0.0% inside

  • /plaintext c=16384 round 1: async had 0 Non-2xx responses and socket errors c/r/w/t 0/571/0/0
  • /db c=256 round 2: async-db had 2006 Non-2xx responses and socket errors c/r/w/t 0/0/0/0
  • /queries?queries=20 c=256 round 1: async-db had 80 Non-2xx responses and socket errors c/r/w/t 0/0/0/0
  • /queries?queries=20 c=256 round 3: async-db had 8 Non-2xx responses and socket errors c/r/w/t 0/0/0/0
  • /updates?queries=20 c=64 round 2: async-db had 7528 Non-2xx responses and socket errors c/r/w/t 0/0/0/0
  • /updates?queries=20 c=256 round 1: async-db had 812 Non-2xx responses and socket errors c/r/w/t 0/0/0/0
  • /updates?queries=20 c=256 round 2: async-db had 110 Non-2xx responses and socket errors c/r/w/t 0/0/0/0
  • /updates?queries=20 c=256 round 3: async-db had 166 Non-2xx responses and socket errors c/r/w/t 0/0/0/0
  • /fortunes c=256 round 1: async-db had 42 Non-2xx responses and socket errors c/r/w/t 0/0/0/0
  • /fortunes c=256 round 2: async-db had 31 Non-2xx responses and socket errors c/r/w/t 0/0/0/0
  • /fortunes c=256 round 3: async-db had 24 Non-2xx responses and socket errors c/r/w/t 0/0/0/0

Why. The figures below come from strace -c, which slows both servers about 9 to 18 times. So read them as counts per request, not as throughput. Each server was started on CPU 0 and warmed for 2 s by the same wrk command. Then strace -c -f -p <pid> was attached for one 3 s wrk run, on 2026-11-10 at 13292203:

taskset -c 0 build/tfb/<entry|async> <port> &
# warm: the test's wrk command below, with -d 2s
strace -c -f -p <pid> &   # attached for the one measured run, stopped with SIGINT after it
taskset -c 1-3 wrk -t 3 -c 256 -d 3s -H "Host: tfb-server" http://127.0.0.1:<port>/plaintext -s bench/techempower/pipeline.lua -- 16
taskset -c 1-3 wrk -t 3 -c 64 -d 3s -H "Host: tfb-server" http://127.0.0.1:<port>/json
The four strace -c tables

entry, /plaintext, 256 connections (402880 requests in 3.10s, 49.56MB read):

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 64.99    0.475305          18     25379           sendto
 31.71    0.231932           9     25381           recvfrom
  1.71    0.012474          31       398           epoll_wait
  0.52    0.003805           7       512           getsockopt
  0.30    0.002202           8       257         1 accept4
  0.27    0.001959           7       256           epoll_ctl
  0.25    0.001825           7       256           getpeername
  0.24    0.001783           6       256           setsockopt
  0.00    0.000028          28         1           close
------ ----------- ----------- --------- --------- ----------------
100.00    0.731313          13     52696         1 total

async, /plaintext, 256 connections (43646 requests in 3.10s, 5.37MB read):

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 94.65    0.850898          18     44857        10 sendto
  3.07    0.027640           9      2826        10 recvfrom
  0.55    0.004971           9       512           getsockopt
  0.53    0.004769          13       345           epoll_ctl
  0.32    0.002880          11       257         1 accept4
  0.27    0.002408           9       256           getpeername
  0.25    0.002263           8       256           setsockopt
  0.23    0.002061          22        90           epoll_wait
  0.07    0.000626          11        56           close
  0.05    0.000439           9        44           fcntl
------ ----------- ----------- --------- --------- ----------------
100.00    0.898955          18     49499        21 total

entry, /json, 64 connections (26741 requests in 3.00s, 3.80MB read):

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 66.02    0.520740          19     26759           sendto
 32.27    0.254495           9     26761           recvfrom
  1.23    0.009683          22       426           epoll_wait
  0.15    0.001209           9       128           getsockopt
  0.10    0.000752          11        65         1 accept4
  0.08    0.000636           9        64           epoll_ctl
  0.08    0.000606           9        64           setsockopt
  0.07    0.000567           8        64           getpeername
  0.01    0.000060          60         1           close
------ ----------- ----------- --------- --------- ----------------
100.00    0.788748          14     54332         1 total

async, /json, 64 connections (24894 requests in 3.00s, 3.54MB read):

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 63.61    0.491892          19     25302           sendto
 31.93    0.246869           9     25750       396 recvfrom
  1.65    0.012736          16       796           epoll_wait
  1.44    0.011107          12       859           epoll_ctl
  0.48    0.003748           9       399           close
  0.48    0.003720           9       397           fcntl
  0.17    0.001322          10       128           getsockopt
  0.10    0.000756          11        65         1 accept4
  0.07    0.000563           8        64           getpeername
  0.07    0.000548           8        64           setsockopt
------ ----------- ----------- --------- --------- ----------------
100.00    0.773261          14     53824       397 total
  • plaintext.
    • The explicit entry answers inside Http1Server's event loop and sends the 16 pipelined answers of one read in one sendto: 25,379 for 402,880 requests.
    • serve takes a connection's next request only once the one before it is answered (std/net/serve.ts, "at most one request per connection is in flight"), and HttpHandler flushes each answer as it ends (end → drive → flush). So a 16-deep burst becomes 16 task runs, each with its own sendto: 44,857 for 43,646 requests.
    • That is about one sendto per request against one per 16. The per-turn calls below are a few hundred in all at this load, so they are not the main share here. How much of the rest is the send and how much the per-request task run was not separated.
  • json is not pipelined, so each entry makes one sendto per answer (26,759 for 26,741 requests; 25,302 for 24,894), and the send count does not explain its gap.
    • What the async entry adds is a fixed cost per turn of the executor's loop. nish_async_wait_fd duplicates the descriptor (fcntl(F_DUPFD_CLOEXEC)) and adds it to epoll, nish_async_fire removes and closes it, and serve writes a wake byte and drains it (the extra sendto and the failing recvfrom).
    • Here that is about 400 turns: 397 fcntl, 399 close, 859 epoll_ctl. Those are about 2,600 calls on 54,000, or 0.1 a request.
    • So the syscall count does not account for 7–12% either. The rest is CPU per request in user space (the task, its frame, the handler's path), which this run did not profile. The cause of json's gap is open.
  • db, queries, updates, fortunes: PgAsyncPool sends one query per connection at a time, where the explicit pool pipelines every request's queries down its 4 connections. A task that finds every connection claimed sleeps 1 ms doubling to 16 ms rather than being woken by a release. The non-2xx answers at 64 and 256 connections are claims that waited out claimWaitMs. That is read from the code, not from a trace.
  • cached-queries reads Postgres only to fill the cache, so it is the one database test near the band. The async database entry's peak RSS is lower (12–21 MiB against 65–66 MiB): the explicit entry reserves its carrier's query room up front.

TechEmpower: the async entry re-measured after the serve and pool fixes (WP49 stage 6)

The same gate as the first measurement, which stays above as the before, run again on main once serve answered a pipelined burst in one write (#1378) and the async Postgres pool pipelined queries across tasks (#1379). The method, the pinning, the * rule and the caveats are the first measurement's: one 4-core VM shared by wrk, Postgres and the server, so a relative A/B and not a TechEmpower rank (D6). The cells are req/s, median (minimum) of 3 interleaved rounds of 10 s, and the band is the gap between each pair of identical builds' medians in this run. run.sh's inside rule is one-sided: a delta d is inside when d >= −band, so an async median above the entry's counts as inside whatever the band. That is how /updates is inside at 256 connections (+4.8% against a 2.5% band) and /queries at 16 (+3.0% against 3.0%): not slower by more than the noise, rather than level within it. One caveat of the first measurement no longer holds: the explicit entry no longer makes more /updates than the async one (the async entry is level or above it), so it no longer adds more of world's dead tuples. Peak RSS is the server's VmHWM, the largest over every round and concurrency of the test.

Date 2026-11-11
nish build/nish at e523e14 (nish 0.38.0 sources), --link --profile speed
CPU Intel(R) Xeon(R) Processor @ 2.10GHz, 4 logical cores, 15 GiB
OS linux 6.18.44 (x64)
Postgres 16, a throwaway cluster in build/tfb/pg, fsync=off, TFB's world (10,000 rows) and fortune tables
Client wrk 4.1.0, TFB's request headers, --timeout 8; /plaintext through bench/techempower/pipeline.lua 16 deep
Pinning plaintext and json: server on CPU 0, wrk -t 3 on CPUs 1-3. Database: server on CPU 0, Postgres on CPU 1, wrk -t 2 on CPUs 2-3
Command npm run build && PG_BIN=/usr/lib/postgresql/16/bin bash bench/techempower/run.sh

Outcome: the gate is still not met. The fixes moved the async entry a long way, but it is outside the band on all three of the gate's tests:

  • plaintext: 32–38% below the explicit entry at 256, 1,024 and 4,096 connections (it was 87–90%), and 70.9% below at 16,384, a * cell.
  • json: 2.5–17.1% below at every concurrency, against bands of 0.5–2.5%. The first run's one inside cell, at 256 connections, is now outside at −6.3% against a 0.5% band.
  • db: 74.2% and 79.4% below at 64 and 256 connections (it was 90.0% and 90.5%). The 16-connection cell cannot be judged: its band is not a usable one (below), so the verdict rests on 64 and 256.

Of the database tests outside the gate, /updates is inside at all three concurrencies, /queries and /cached-queries are inside at 16 and 16–64 connections, and /fortunes is outside everywhere.

test connections band async vs entry verdict first run (2026-11-10)
/plaintext 256 2.6% −33.3% outside −89.7%
/plaintext 1024 1.4% −32.0% outside −87.1%
/plaintext 4096 0.1% −38.3% outside −86.6%
/plaintext 16384 8.3% −70.9% outside* −87.2%*
/json 16 1.1% −2.5% outside −9.8%
/json 32 1.0% −4.1% outside −8.8%
/json 64 0.9% −6.2% outside −7.3%
/json 128 2.2% −7.4% outside −12.4%
/json 256 0.5% −6.3% outside −1.5% (see its note)
/json 512 2.5% −17.1% outside −11.7%
/db 16 58.3% (see below) −61.7% not judged (run.sh: outside) −42.1%
/db 64 3.1% −74.2% outside −90.0%
/db 256 5.7% −79.4% outside −90.5%*
/queries?queries=20 16 3.0% +3.0% inside −65.3%
/queries?queries=20 64 3.4% −10.6% outside −67.2%
/queries?queries=20 256 0.9% −47.1% outside −74.7%*
/updates?queries=20 16 3.5% +2.9% inside −54.9%
/updates?queries=20 64 3.3% +4.4% inside −55.8%*
/updates?queries=20 256 2.5% +4.8% inside −61.2%*
/fortunes 16 2.2% −42.7% outside −59.5%
/fortunes 64 4.5% −66.8% outside −66.2%
/fortunes 256 3.0% −73.8% outside −70.1%*
/cached-queries?count=100 16 9.3% +6.4% inside −12.0%
/cached-queries?count=100 64 2.5% +1.1% inside −5.8%
/cached-queries?count=100 256 0.4% −1.5% outside +0.0%

The /db band at 16 connections is not a usable one. Both explicit builds came out in one of two modes, about 23–30k or 72–75k req/s, from round to round (db-entry 28,234, 72,518 and 75,337; db-entry-copy 74,689, 30,208 and 22,957), so the band measures which mode each median landed in. The async entry gave 27.7–28.5k in every round, the low mode, so against a single mode it could be level or 62% below. run.sh prints outside; this record does not judge the cell, and the db verdict rests on 64 and 256 connections. The cause of the two modes was not looked into. /cached-queries at 16 connections has a 9.3% band from the same kind of spread, so its inside is a weak one.

/plaintext, req/s, median (min) of 3 rounds of 10 s, re-measured

contestant 256 1024 4096 16384 peak RSS, MiB
entry 1204101 (1172640) 1059054 (992161) 880224 (850177) 1055627 (747604) 91.2
entry-copy 1234846 (1215438) 1044029 (896590) 881446 (841335) 968281 (926261)* 91.2
async 802852 (761485) 719771 (686223) 542753 (534766) 307229 (293830)* 95.8

noise band (|entry - entry-copy| / entry, medians): 256: 2.6% 1024: 1.4% 4096: 0.1% 16384: 8.3% async vs entry (median delta, inside or outside the band; * had failures, never inside): 256: -33.3% outside 1024: -32.0% outside 4096: -38.3% outside 16384: -70.9% outside*

/json, req/s, median (min) of 3 rounds of 10 s, re-measured

contestant 16 32 64 128 256 512 peak RSS, MiB
entry 102798 (101503) 127092 (124352) 140167 (134367) 165899 (163881) 177846 (161172) 181928 (163661) 3.1
entry-copy 103975 (99645) 125833 (119857) 141396 (138863) 162254 (156184) 178795 (146870) 186457 (180583) 3.1
async 100264 (98126) 121847 (121472) 131489 (128084) 153656 (149006) 166652 (159560) 150806 (140936) 7.6

noise band (|entry - entry-copy| / entry, medians): 16: 1.1% 32: 1.0% 64: 0.9% 128: 2.2% 256: 0.5% 512: 2.5% async vs entry (median delta, inside or outside the band; * had failures, never inside): 16: -2.5% outside 32: -4.1% outside 64: -6.2% outside 128: -7.4% outside 256: -6.3% outside 512: -17.1% outside

/db, req/s, median (min) of 3 rounds of 10 s, re-measured

contestant 16 64 256 peak RSS, MiB
db-entry 72518 (28234) 101671 (33837) 105023 (102444) 65.6
db-entry-copy 30208 (22957) 98495 (96230) 110978 (101251) 65.6
async-db 27775 (27737) 26228 (26180) 21642 (20455) 22.6

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 58.3% 64: 3.1% 256: 5.7% async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: -61.7% outside 64: -74.2% outside 256: -79.4% outside

/queries?queries=20, req/s, median (min) of 3 rounds of 10 s, re-measured

contestant 16 64 256 peak RSS, MiB
db-entry 24081 (23777) 25508 (25297) 35982 (35381) 66.1
db-entry-copy 23358 (23239) 24652 (23706) 35647 (34140) 66.1
async-db 24797 (24552) 22805 (22273) 19029 (17990) 24.4

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 3.0% 64: 3.4% 256: 0.9% async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: +3.0% inside 64: -10.6% outside 256: -47.1% outside

/updates?queries=20, req/s, median (min) of 3 rounds of 10 s, re-measured

contestant 16 64 256 peak RSS, MiB
db-entry 6495 (6441) 6922 (6639) 7411 (6528) 66.1
db-entry-copy 6720 (6510) 6693 (6477) 7227 (6539) 66.1
async-db 6687 (6590) 7228 (7045) 7766 (7738) 29.5

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 3.5% 64: 3.3% 256: 2.5% async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: +2.9% inside 64: +4.4% inside 256: +4.8% inside

/fortunes, req/s, median (min) of 3 rounds of 10 s, re-measured

contestant 16 64 256 peak RSS, MiB
db-entry 55926 (54291) 66683 (66674) 65773 (62826) 65.5
db-entry-copy 54699 (52963) 69651 (67101) 63816 (63776) 65.5
async-db 32068 (31763) 22122 (20784) 17227 (16411) 24.5

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 2.2% 64: 4.5% 256: 3.0% async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: -42.7% outside 64: -66.8% outside 256: -73.8% outside

/cached-queries?count=100, req/s, median (min) of 3 rounds of 10 s, re-measured

contestant 16 64 256 peak RSS, MiB
db-entry 55846 (54174) 64787 (60459) 67372 (65461) 65.3
db-entry-copy 61022 (57024) 66397 (62252) 67634 (59247) 65.4
async-db 59423 (56138) 65517 (64454) 66345 (63481) 18.3

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 9.3% 64: 2.5% 256: 0.4% async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: +6.4% inside 64: +1.1% inside 256: -1.5% outside

  • /plaintext c=16384 round 1: entry-copy had 0 Non-2xx responses and socket errors c/r/w/t 0/9141/0/0
  • /plaintext c=16384 round 1: async had 0 Non-2xx responses and socket errors c/r/w/t 0/4259/0/0
  • /plaintext c=16384 round 2: async had 0 Non-2xx responses and socket errors c/r/w/t 0/2683/0/0
  • /plaintext c=16384 round 3: async had 0 Non-2xx responses and socket errors c/r/w/t 0/2491/0/0

No database cell has a * this time; the first run had five, all the async entry's, from ten rounds with non-2xx answers while it waited for a connection.

Memory. The async entry's peak RSS is above the explicit entry's on plaintext (95.8 against 91.2 MiB, at 16,384 connections) and on json (7.6 against 3.1 MiB). On the database tests it is below (18.3–29.5 against 65.3–66.1 MiB), because the explicit entry reserves its carrier's query room up front. Against the first run, the async entry's peak rose on every test (plaintext 91.5 → 95.8, json 3.3 → 7.6, database 12.1–20.8 → 18.3–29.5 MiB).

Why, as far as this run goes. The strace -c counts were taken the same way as the first run's, on 2026-11-11 at e523e14. They slow both servers several times, so read them as calls per request, not throughput:

taskset -c 0 build/tfb/<entry|async> <port> &
# warm: the test's wrk command below, with -d 2s
strace -c -f -p <pid> &   # attached for the one measured run, stopped with SIGINT after it
taskset -c 1-3 wrk -t 3 -c 256 -d 3s -H "Host: tfb-server" http://127.0.0.1:<port>/plaintext -s bench/techempower/pipeline.lua -- 16
taskset -c 1-3 wrk -t 3 -c 64 -d 3s -H "Host: tfb-server" http://127.0.0.1:<port>/json
The four strace -c tables, re-measured

entry, /plaintext, 256 connections (326288 requests in 3.05s, 40.14MB read):

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 64.48    0.453139          22     20440           sendto
 31.67    0.222573          10     20441           recvfrom
  1.70    0.011916          37       321           epoll_wait
  0.70    0.004947           9       512           getsockopt
  0.41    0.002856          11       257         1 accept4
  0.37    0.002586          10       256           epoll_ctl
  0.33    0.002345           9       256           setsockopt
  0.33    0.002290           8       256           getpeername
  0.01    0.000073          73         1           close
------ ----------- ----------- --------- --------- ----------------
100.00    0.702725          16     42740         1 total

async, /plaintext, 256 connections (301616 requests in 3.06s, 37.11MB read):

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 59.15    0.367425          19     18943           sendto
 33.38    0.207367          10     18990         3 recvfrom
  2.43    0.015114          17       851           epoll_ctl
  1.92    0.011951          20       596           epoll_wait
  0.92    0.005705          11       512           getsockopt
  0.49    0.003017          11       257         1 accept4
  0.46    0.002849           9       299           close
  0.45    0.002804           9       297           fcntl
  0.40    0.002485           9       256           getpeername
  0.40    0.002479           9       256           setsockopt
------ ----------- ----------- --------- --------- ----------------
100.00    0.621196          15     41257         4 total

entry, /json, 64 connections (23239 requests in 3.03s, 3.30MB read):

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 65.52    0.502779          21     23286           sendto
 32.62    0.250341          10     23287           recvfrom
  1.33    0.010187          27       372           epoll_wait
  0.17    0.001322          10       128           getsockopt
  0.10    0.000784          12        65         1 accept4
  0.09    0.000679          10        64           epoll_ctl
  0.08    0.000619           9        64           getpeername
  0.08    0.000618           9        64           setsockopt
  0.01    0.000057          57         1           close
------ ----------- ----------- --------- --------- ----------------
100.00    0.767386          16     47331         1 total

async, /json, 64 connections (21584 requests in 3.02s, 3.07MB read):

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 64.75    0.476769          22     21612           sendto
 30.52    0.224764          10     21654         3 recvfrom
  1.67    0.012283          17       692           epoll_wait
  1.55    0.011377          15       755           epoll_ctl
  0.51    0.003735          10       347           close
  0.47    0.003447           9       345           fcntl
  0.20    0.001463          11       128           getsockopt
  0.14    0.001031          15        65         1 accept4
  0.11    0.000786          12        64           setsockopt
  0.09    0.000696          10        64           getpeername
------ ----------- ----------- --------- --------- ----------------
100.00    0.736351          16     45726         4 total
  • plaintext. #1378 removed the send gap: the async entry now makes one sendto per pipelined burst, as the explicit loop does (18,943 for 301,616 requests, against 20,440 for 326,288). Its extra calls per executor turn (297 fcntl, 299 close, 851 epoll_ctl) are about 0.005 a request. So system calls no longer account for the remaining 32–38%. What is left is CPU per request in user space: the async entry still runs one task turn per request where the explicit loop answers a burst inside one read. That was not profiled. At 16,384 connections the async entry also had wrk read errors in every round, which the explicit entry had in one copy's round; their cause was not looked into.
  • json is unchanged in kind from the first run: one sendto per answer on both sides (23,286 for 23,239; 21,612 for 21,584), and about 345 executor turns' fcntl/close/epoll_ctl, about 0.07 calls a request. The 2.5–17.1% is CPU per request in user space, and it was not profiled. #1378's json figures were already mixed and recorded open; the cause is still open.
  • db, queries, fortunes. The async entry now gains less, or loses, as connections rise, where the explicit entry gains: /db 27.8k → 21.6k from 16 to 256 connections against 72.5k → 105.0k; /queries 24.8k → 19.0k against 24.1k → 36.0k; /fortunes 32.1k → 17.2k against 55.9k → 65.8k. With #1379 a connection takes at most 8 seated statements (its default depth), each sent with its own Sync, and a task queues for a seat when all 4 connections are full; the explicit carrier pipelines every in-flight request's query. Whether the depth, the per-statement Sync or the task turns limit it was not traced, so the cause is open. #1379 already recorded /fortunes at 64 and more connections as slower than the previous async pool, cause unmeasured; this run agrees (22.1k and 17.2k against the first run's 25.0k and 22.9k).
  • updates is inside the band at every concurrency. Its 20 updates per request are sent as one statement by both entries, which suggests Postgres's write path, not the pool, sets the rate there; that is inferred from the figures, not traced.

TechEmpower: where the async entry's time goes, a profile (WP49 stage 6)

The re-measurement left plaintext, json and db outside the gate, and their system calls do not explain it. This profile asks where each request's time goes in user space, on the async entry against the explicit one, so that the next fixes have a target. It measures; it fixes nothing. bash bench/techempower/profile.sh reproduces it, and --help says the method.

Date 2026-11-11
Sources main at 0e338d83. Each table's header names the branch commit the script ran at, which adds only profile.sh. /plaintext ran at b26ed0b4 and /json and /db at ddd1240c. Between the two, the script changed only the /db cluster's setup, which also loads fortune because the entries prepare its statement at start. The method did not change.
Build build/nish <entry> --link --profile speed -g. The -g keeps the symbols. The -g build's text is within 1.2% of the build without it, by size: 72,687 bytes for the explicit plaintext entry against 73,535 without -g (1.2%), and 137,260 for the async one against 137,996 (0.5%)
CPU Intel(R) Xeon(R) Processor @ 2.10GHz, 4 logical cores (a cloud VM, no hardware performance counters)
Load /plaintext at 256 connections, 16 pipelined (pipeline.lua); /json at 64; /db at 64 against run.sh's throwaway Postgres (port 15433), one worker and 4 Postgres connections on both sides
Pinning server on CPU 0; wrk on CPUs 1–3, or 2–3 with Postgres on CPU 1 for /db

Each figure comes from one tool, run in its own phase so that no tool's overhead lands in another's figure. The phases alternate between the two entries.

  • Instructions per request (Ir): callgrind (valgrind 3.22). The server starts with --instr-atstart=no; callgrind_control -i on and -i off bracket a 10 s wrk window, and Ir per request is the window's program total divided by wrk's responses. Requests in flight at the window's edges are counted on the wrong side, so a figure can be off by at most the in-flight requests over the responses: 4,096 (256 × 16) on /plaintext, about 3.5% of the async window; 64 on /json and /db, under 0.4%. callgrind_annotate --auto=no lists the frames, and the script sums a function's lines across the files it was inlined from.
  • Top user-space frames: perf record -e cpu-clock:u -F 2999 -g (perf 6.8.12) over a 5 s wrk window. cpu-clock:u is a software event, since the VM exposes no hardware counters. The share is of user-space samples only.
  • System calls per request: strace -c -f -p over a 5 s wrk window.
  • req/s and CPU per request: wrk and the server's utime + stime in /proc/<pid>/stat, over the perf window. Both are under perf, so they are not the gate's figures.
test Ir per request, explicit → async system calls per request CPU µs per request req/s under perf
/plaintext (256, 16 pipelined) 5,419 → 11,662 (+6,243, ×2.15) 0.132 → 0.137 0.93 → 1.58 1,056k → 629k
/json (64) 6,614 → 13,153 (+6,539, ×1.99) 2.037 → 2.116 7.37 → 8.13 135k → 122k
/db (64) 11,017 → 37,229 (+26,212, ×3.38) 2.100 → 24.008 9.96 → 39.70 81.3k → 24.5k

All six perf runs were clean (no wrk socket errors, no non-2xx answers). The codec's frames (http1Next, http1TakeLine, http1WriteResponseHead) cost the same on both sides of every test. The difference is in the layer the async entry puts between the codec and the handler, and on /db in the pool. The causes below are ranked by the Ir per request each accounts for, from the frames' self Ir (callgrind), with the source line where the count is a line's. The one exception is /db's cause 2, which is kernel time with no Ir figure: it is placed by its system calls (strace) and CPU per request (/proc). WP49 §6 carries the same ranking as the plan for the fixes.

/plaintext and /json (fix-serve). The same functions make the gap on both. They are ranked by the two tests' Ir summed, and each function's self Ir per request is netted against the explicit side's (plaintext first, then json):

  1. serveTask copies each request in and each answer out, byte by byte (std/net/serve.ts), with HttpRequest.constructor: 3,158 and 3,428. Of plaintext's: the head copy (head[i] = src.head[i] and its loop) about 1,880, the scan for the head's end about 220, the spans about 225, and the new arrays and their zeroing about 170. Then the answer is copied back into the slot (out[i] = res.body[i]), about 190, and its content type a character at a time (type[i] = toU8(res.type.charCodeAt(i))), about 160.
  2. The HttpHandler layer (std/net/handler.ts): drive, start, write, end, enqueue, settle and flush, and the Http1Server/Http1Connection calls they make, 1,313 and 1,596.
  3. serveOn's scans (std/net/serve.ts): 690 and 896, mostly the pass over every slot after each turn (serveFreeSlot's scan about 160, then the busy/done checks) and serveType's byte compare of the content-type cache, about 70.
  4. The task per request and its memory: nish_async_spawn, nish_async_done, malloc/free/_int_free and nish_arena_release, 707 and 704.
  5. Router.match and Router.walk (std/net/router.ts), which the explicit entry does not run: 789 and 562. routerSameBytes compares the path a byte at a time.

Against these, the explicit loop's own dispatch (TfbServer.resume and nish_main, 655 and 919) has no async counterpart. Net of it, the five account for about 6,000 of plaintext's 6,243 and 6,270 of json's 6,539. On /plaintext the user-space path is most of a request, so the async entry's CPU per request is 1.7 times the explicit one's. On /json the kernel's share of a request (one receive and one send each) is large, so twice the instructions show as 10% more CPU, within the 2.5–17.1% of json's gap in the gate.

/db (fix-pool; causes 3 and 4 are serve's and go with fix-serve). Causes 1, 3, 4 and 5 are ranked by Ir. Cause 2 is ranked by system calls and CPU time, because its cost is in the kernel:

  1. pgAsyncRead zero-fills a fresh 8 KiB buffer per answer (std/net/postgres-async.ts, new Array<u8>(… PG_ASYNC_INPUT_SIZE)): __memset_avx2_unaligned_erms is 8,360 Ir a request, 22% of the async total, 8,211 of it called from pgAsyncAnswer. The answer is then copied twice, a byte at a time: into carried in pgAsyncAnswer and into that buffer in pgAsyncRead, about 1,400. About 9,800 in all.
  2. Two waits per statement, and the system calls they cost. Each request waits about 2.7 times in nish_async_wait_fd: once in pgAsyncPark on the pool's wake socket pair for its turn (1.04 a request), once in pgAsyncTurn on the Postgres socket (0.99), and serveOn's own wait (0.71). The Postgres socket is also waited on, through readable(fd), in pgAsyncRead when a read answers EAGAIN. That is where most of the 22 extra system calls a request go: 6.0 epoll_ctl, 3.0 fcntl, 3.0 close, 2.0 epoll_wait, 3.0 more sendto and 4.9 more recvfrom, 1.9 of which answer EAGAIN, against the explicit entry's one sendto and one recvfrom. The Ir is small; the cost is kernel time, most of the 39.7 µs against 9.96. What one wait costs was settled in #1374. What is open here is the number of waits the pool takes per statement.
  3. serveOn scans every slot on each pass (std/net/serve.ts), for fix-serve: 5,690 self here against 690 on /plaintext, because a request's task stays in flight across its Postgres round trip, so more slots are busy. The busy && done check costs about 980, the busy && hungUp check about 870, and the loop 640. The hungUp call into HttpHandler.hungUp and Http1Server.holds costs about 1,600. Together, about 4,100.
  4. serveTask's copies, as on /plaintext: 3,988 self.
  5. The seat bookkeeping: pgAsyncSkippable (4 calls a request, each a loop over PG_ASYNC_MAX_DEPTH), pgAsyncSeat, pgAsyncSend, pgAsyncReady, pgAsyncTurn, pgAsyncScan, pgAsyncSignal and pgAsyncPark, about 3,600 self, against about 1,300 for the explicit carrier's PgCarrier.next, PgCarrier.dispatch and TfbDb.turn. So about 2,300 net.

Net of the explicit carrier's 1,300, the four with an Ir figure (1, 3, 4 and 5) account for about 20,200 of the 26,212.

/plaintext, 256 connections, 16 pipelined: the table and the top 12 frames of each side, as profile.sh wrote them

Intel(R) Xeon(R) Processor @ 2.10GHz, 4 CPUs, 2026-11-11, b26ed0b4; perf version 6.8.12, valgrind-3.22.0, wrk debian/4.1.0-4build2; phases of 5 s (perf, strace) and 10 s (callgrind)

explicit async
Ir per request (callgrind) 5419 11662
responses in the callgrind window 204800 115552
system calls per request (strace -c) 0.132 0.137
req/s under perf 1056265.24 628843.11
server CPU µs per request, user + system (/proc) 0.93 1.58
wrk errors in the perf run clean clean

explicit, top 12 frames by self Ir per request (callgrind):

    2180.6  nish.http1Next
     900.5  nish.http1WriteResponseHead
     669.7  nish.http1TakeLine
     331.9  TfbServer.resume
     323.4  nish_main
     252.7  nish.http1HeadAppend
     153.0  __memcpy_avx_unaligned_erms
     145.4  nish.http1PutBytes
      77.2  nish.http1PutStatusLine
      76.2  nish.http1PutCrlf
      54.2  nish.http1PutDecimal
      50.1  nish.Http1Connection.bodyRoom

explicit, top 12 user-space frames by self samples (perf, cpu-clock):

    37.28%  entry          [.] nish.http1Next
    14.68%  entry          [.] nish.http1WriteResponseHead
    10.23%  entry          [.] nish.http1TakeLine
     8.07%  entry          [.] nish_main
     6.38%  entry          [.] TfbServer.resume
     4.91%  libc.so.6      [.] __memmove_avx512_unaligned_erms
     2.60%  entry          [.] nish.http1HeadAppend
     1.95%  entry          [.] nish.http1PutBytes
     1.86%  entry          [.] nish.http1PutStatusLine
     1.45%  entry          [.] nish.Http1Connection.bodyRoom
     1.14%  [vdso]         [.] __vdso_clock_gettime
     1.07%  libc.so.6      [.] __send

async, top 12 frames by self Ir per request (callgrind):

    3065.9  nish.serveTask$fn.9.tfbHandle.resume
    2187.2  nish.http1Next
     891.9  nish.http1WriteResponseHead
     690.2  nish.serveOn$fn.9.tfbHandle.resume
     671.5  nish.http1TakeLine
     653.2  nish.HttpHandler.drive
     443.2  nish.Router.match
     296.1  nish.Router.walk
     253.8  nish.http1HeadAppend
     244.6  nish.HttpHandler.start
     196.9  __memcpy_avx_unaligned_erms
     182.3  nish_async_done

async, top 12 user-space frames by self samples (perf, cpu-clock):

    19.72%  async          [.] nish.serveTask$fn.9.tfbHandle.resume
    17.83%  async          [.] nish.http1Next
     7.33%  async          [.] nish.serveOn$fn.9.tfbHandle.resume
     7.32%  async          [.] nish.HttpHandler.drive
     6.61%  async          [.] nish.http1WriteResponseHead
     4.91%  async          [.] nish.http1TakeLine
     3.64%  [vdso]         [.] __vdso_clock_gettime
     3.00%  async          [.] nish.Router.match
     3.00%  async          [.] nish.Router.walk
     2.89%  libc.so.6      [.] __memmove_avx512_unaligned_erms
     2.64%  async          [.] nish.HttpHandler.start
     1.57%  async          [.] nish.http1HeadAppend
/json, 64 connections: the table and the top 12 frames of each side, as profile.sh wrote them

Intel(R) Xeon(R) Processor @ 2.10GHz, 4 CPUs, 2026-11-11, ddd1240c; perf version 6.8.12, valgrind-3.22.0, wrk debian/4.1.0-4build2; phases of 5 s (perf, strace) and 10 s (callgrind)

explicit async
Ir per request (callgrind) 6614 13153
responses in the callgrind window 121576 88648
system calls per request (strace -c) 2.037 2.116
req/s under perf 134652.32 122067.63
server CPU µs per request, user + system (/proc) 7.37 8.13
wrk errors in the perf run clean clean

explicit, top 12 frames by self Ir per request (callgrind):

    2228.2  nish.http1Next
     817.4  nish.http1WriteResponseHead
     711.1  nish.http1TakeLine
     585.7  nish_main
     434.2  nish.jsonWriterPutString
     333.2  TfbServer.resume
     252.1  nish.http1HeadAppend
     161.1  __memcpy_avx_unaligned_erms
     145.1  nish.http1PutBytes
     136.1  nish.Http1Server.send
     100.1  nish.Http1Connection.inputRoom
      84.0  nish.Http1Connection.feed

explicit, top 12 user-space frames by self samples (perf, cpu-clock):

    21.21%  entry          [.] nish.http1Next
    11.03%  entry          [.] nish_main
     8.76%  [vdso]         [.] __vdso_clock_gettime
     7.94%  entry          [.] nish.http1WriteResponseHead
     7.86%  libc.so.6      [.] __send
     6.41%  entry          [.] nish.http1TakeLine
     5.74%  libc.so.6      [.] __memmove_avx512_unaligned_erms
     4.25%  libc.so.6      [.] __libc_recv
     3.73%  entry          [.] nish.Http1Server.send
     3.65%  entry          [.] TfbServer.resume
     3.39%  entry          [.] nish.jsonWriterPutString
     2.80%  entry          [.] nish.Http1Connection.inputRoom

async, top 12 frames by self Ir per request (callgrind):

    3337.1  nish.serveTask$fn.9.tfbHandle.resume
    2225.4  nish.http1Next
     896.3  nish.serveOn$fn.9.tfbHandle.resume
     803.5  nish.http1WriteResponseHead
     702.0  nish.http1TakeLine
     682.5  nish.HttpHandler.drive
     434.3  nish.jsonWriterPutString
     335.2  nish.Router.match
     252.2  nish.http1HeadAppend
     243.2  nish.HttpHandler.start
     191.1  __memcpy_avx_unaligned_erms
     181.1  nish_async_done

async, top 12 user-space frames by self samples (perf, cpu-clock):

    16.13%  async          [.] nish.serveTask$fn.9.tfbHandle.resume
    13.91%  async          [.] nish.http1Next
     7.45%  async          [.] nish.serveOn$fn.9.tfbHandle.resume
     7.28%  [vdso]         [.] __vdso_clock_gettime
     5.57%  async          [.] nish.HttpHandler.drive
     4.44%  libc.so.6      [.] __send
     3.83%  async          [.] nish.http1WriteResponseHead
     3.47%  async          [.] nish.Http1Server.send
     3.47%  async          [.] nish.http1TakeLine
     2.75%  libc.so.6      [.] __libc_recv
     2.53%  libc.so.6      [.] __memmove_avx512_unaligned_erms
     2.24%  async          [.] nish.HttpHandler.start
/db, 64 connections, one worker and 4 Postgres connections: the table and the top 12 frames of each side, as profile.sh wrote them

Intel(R) Xeon(R) Processor @ 2.10GHz, 4 CPUs, 2026-11-11, ddd1240c; perf version 6.8.12, valgrind-3.22.0, wrk debian/4.1.0-4build2; phases of 5 s (perf, strace) and 10 s (callgrind)

explicit async
Ir per request (callgrind) 11017 37229
responses in the callgrind window 83376 18521
system calls per request (strace -c) 2.100 24.008
req/s under perf 81323.52 24502.56
server CPU µs per request, user + system (/proc) 9.96 39.70
wrk errors in the perf run clean clean

explicit, top 12 frames by self Ir per request (callgrind):

    2228.7  nish.http1Next
     803.6  nish.http1WriteResponseHead
     709.5  nish.http1TakeLine
     626.2  nish.PgCarrier.next
     588.5  nish.HttpHandler.drive
     455.0  TfbDb.turn
     353.3  nish.JsonWriter.i64
     326.2  nish.jsonWriterPutString
     293.2  nish.Router.match
     275.4  nish.PgText.int
     252.2  nish.http1HeadAppend
     230.2  nish.HttpHandler.start

explicit, top 12 user-space frames by self samples (perf, cpu-clock):

    12.61%  db-entry       [.] nish.http1Next
    10.38%  db-entry       [.] TfbDb.turn
     7.90%  db-entry       [.] nish.PgCarrier.next
     6.55%  [vdso]         [.] __vdso_clock_gettime
     5.05%  db-entry       [.] nish.HttpHandler.drive
     4.81%  db-entry       [.] nish.http1WriteResponseHead
     4.44%  libc.so.6      [.] __send
     3.70%  db-entry       [.] nish.HttpHandler.start
     3.31%  db-entry       [.] nish.http1TakeLine
     3.18%  libc.so.6      [.] __memmove_avx512_unaligned_erms
     2.45%  db-entry       [.] nish.Http1Server.send
     2.42%  libc.so.6      [.] __libc_recv

async, top 12 frames by self Ir per request (callgrind):

    8360.0  __memset_avx2_unaligned_erms
    5690.8  nish.serveOn$fn.17.tfbServeDb$arrow0.resume
    3987.8  nish.serveTask$fn.17.tfbServeDb$arrow0.resume
    2395.7  nish.pgAsyncAnswer.resume
    2231.5  nish.http1Next
     924.6  nish.pgAsyncSkippable
     805.0  nish.http1WriteResponseHead
     739.5  nish.pgAsyncSeat.resume
     703.3  nish.http1TakeLine
     670.1  nish.HttpHandler.drive
     472.1  nish.pgAsyncSend.resume
     377.1  nish.pgAsyncReady

async, top 12 user-space frames by self samples (perf, cpu-clock):

    10.14%  async-db       [.] nish.serveTask$fn.17.tfbServeDb$arrow0.resume
    10.11%  async-db       [.] nish.serveOn$fn.17.tfbServeDb$arrow0.resume
     6.53%  libc.so.6      [.] epoll_ctl
     5.72%  async-db       [.] nish.pgAsyncAnswer.resume
     3.81%  libc.so.6      [.] __libc_recv
     3.73%  libc.so.6      [.] __send
     3.64%  async-db       [.] nish.http1Next
     3.38%  [vdso]         [.] __vdso_clock_gettime
     3.35%  libc.so.6      [.] __fcntl64_nocancel_adjusted
     3.29%  libc.so.6      [.] __close
     2.66%  async-db       [.] nish.pgAsyncSkippable
     2.28%  async-db       [.] nish.pgAsyncPark.resume

TechEmpower: the async entry re-measured after the profile-led fixes (WP49 stage 6)

The same gate as the first measurement and the 2026-11-11 re-measurement, which stay above as the befores, run again once the profile (#1410) had ranked where the async entry's time goes and three PRs had acted on it: #1421 cut serve's per-request copies and slot scans, #1419 cut the async Postgres pool's buffer fill and waits and batched the async entry's concurrent /db ids into one statement, and #1459 trimmed the router's walk and serveTask's copies. The method, the pinning, the * rule and the caveats are the first measurement's: one 4-core VM shared by wrk, Postgres and the server, so a relative A/B and not a TechEmpower rank (D6). The cells are req/s, median (minimum) of 3 interleaved rounds of 10 s, and the band is the gap between each pair of identical builds' medians in this run. run.sh's inside rule is one-sided: a delta d is inside when d >= −band. Peak RSS is the server's VmHWM, the largest over every round and concurrency of the test.

The tree measured is #1459's head f9ffe352 merged locally with main at 747126db, which #1459 had not yet taken in (#1444, #1448, #1452). The merge's only conflict is tests/nish-cmp.js, which no benchmark binary reads. #1448 makes the explicit entry fork one worker a CPU by default, but the worker count is availableParallelism(), which reads the affinity mask, and run.sh starts every server under taskset -c 0: the explicit entry still runs as one process, as in the earlier runs.

Date 2026-11-12
nish build/nish built from #1459's head f9ffe352 merged locally with main at 747126db, a merge that has no published SHA (nish 0.38.0 sources), --link --profile speed
CPU Intel(R) Xeon(R) Processor @ 2.10GHz, 4 logical cores, 15 GiB
OS linux 6.18.44 (x64)
Postgres 16, a throwaway cluster in build/tfb/pg, fsync=off, TFB's world (10,000 rows) and fortune tables
Client wrk 4.1.0, TFB's request headers, --timeout 8; /plaintext through bench/techempower/pipeline.lua 16 deep
Pinning plaintext and json: server on CPU 0, wrk -t 3 on CPUs 1-3. Database: server on CPU 0, Postgres on CPU 1, wrk -t 2 on CPUs 2-3
Command npm run build && PG_BIN=/usr/lib/postgresql/16/bin bash bench/techempower/run.sh

Outcome: the gate is still not met. Six of the eleven judged cells are outside:

  • plaintext: outside at all three judged concurrencies, 27.7%, 15.0% and 26.9% below the explicit entry at 256, 1,024 and 4,096 connections (they were 32–38% below). At 16,384, recorded and not judged, it is 68.0% below, a * cell again.
  • json: inside at 16, 32, 64 and 256 connections and outside at 128 (−4.9% against a 0.5% band) and 512 (−13.0% against 5.7%). The 256 cell is inside on a 9.5% band, so it is a weak inside.
  • db: outside at 64 connections (−5.7% against a 2.2% band) and inside at 256 (+7.3%). It was 74.2% and 79.4% below. The 16-connection cell is bimodal again (below) and recorded, not judged.

Of the database tests outside the gate, /updates and /cached-queries are inside at all three concurrencies, /queries at 16 and 64 connections, and /fortunes nowhere.

test connections band async vs entry verdict 2026-11-11
/plaintext 256 11.1% −27.7% outside −33.3%
/plaintext 1024 1.1% −15.0% outside −32.0%
/plaintext 4096 1.2% −26.9% outside −38.3%
/plaintext 16384 0.8% −68.0% not judged (run.sh: outside*) −70.9%*
/json 16 2.9% −2.0% inside −2.5%
/json 32 2.9% −0.5% inside −4.1%
/json 64 0.3% +0.5% inside −6.2%
/json 128 0.5% −4.9% outside −7.4%
/json 256 9.5% −3.6% inside −6.3%
/json 512 5.7% −13.0% outside −17.1%
/db 16 64.9% (bimodal) −23.4% not judged (run.sh: inside) −61.7%
/db 64 2.2% −5.7% outside −74.2%
/db 256 0.7% +7.3% inside −79.4%
/queries?queries=20 16 0.3% +10.8% inside +3.0%
/queries?queries=20 64 1.5% +19.3% inside −10.6%
/queries?queries=20 256 1.7% −18.0% outside −47.1%
/updates?queries=20 16 1.0% +6.4% inside +2.9%
/updates?queries=20 64 3.6% +7.0% inside +4.4%
/updates?queries=20 256 3.4% +8.7% inside +4.8%
/fortunes 16 2.1% −31.2% outside −42.7%
/fortunes 64 0.3% −11.2% outside −66.8%
/fortunes 256 0.8% −44.1% outside −73.8%
/cached-queries?count=100 16 0.4% +8.2% inside +6.4%
/cached-queries?count=100 64 1.0% +19.1% inside +1.1%
/cached-queries?count=100 256 2.8% +17.3% inside −1.5%

The /db band at 16 connections is bimodal as it was on 2026-11-11: each explicit build landed at about 24–25k or 72–75k req/s from round to round (db-entry 24,250, 72,613 and 75,228; db-entry-copy 75,169, 25,484 and 24,521), so the band measures which mode each median fell in. The async entry gave 47.3–57.0k. run.sh prints inside; this record does not judge the cell, and the db verdict rests on 64 and 256 connections. The cause of the two modes is still not looked into. The /plaintext band at 256 connections is wide for one round: entry-copy's first round gave 1,067,409 against 1,428,775 and 1,240,902 in its others. The async entry, at 1,005,222–1,030,827, is below every explicit round of both builds, so the cell is outside however that round is read.

The async entry now beats the explicit one on /queries at 16 and 64 connections, on /updates and on /cached-queries. The gain is most likely the pool's changes in #1419; that is inferred, not traced.

/plaintext, req/s, median (min) of 3 rounds of 10 s, after the profile-led fixes

contestant 256 1024 4096 16384 peak RSS, MiB
entry 1396208 (1344380) 1095950 (1001872) 943732 (800621) 1080717 (731886) 91.4
entry-copy 1240902 (1067409) 1108102 (1030718) 932337 (879035) 1071958 (1013306) 91.4
async 1008885 (1005222) 931658 (897180) 689535 (673403) 346017 (319578)* 95.8

noise band (|entry - entry-copy| / entry, medians): 256: 11.1% 1024: 1.1% 4096: 1.2% 16384: 0.8% async vs entry (median delta, inside or outside the band; * had failures, never inside): 256: -27.7% outside 1024: -15.0% outside 4096: -26.9% outside 16384: -68.0% outside*

/json, req/s, median (min) of 3 rounds of 10 s, after the profile-led fixes

contestant 16 32 64 128 256 512 peak RSS, MiB
entry 105795 (104852) 124321 (122100) 143372 (143235) 168990 (165456) 181760 (179787) 201539 (183377) 3.3
entry-copy 108840 (107895) 127949 (125784) 143794 (139751) 168113 (160339) 164446 (148537) 189963 (188113) 3.3
async 103722 (103013) 123661 (121990) 144040 (139898) 160681 (157016) 175217 (169509) 175407 (164065) 7.6

noise band (|entry - entry-copy| / entry, medians): 16: 2.9% 32: 2.9% 64: 0.3% 128: 0.5% 256: 9.5% 512: 5.7% async vs entry (median delta, inside or outside the band; * had failures, never inside): 16: -2.0% inside 32: -0.5% inside 64: +0.5% inside 128: -4.9% outside 256: -3.6% inside 512: -13.0% outside

/db, req/s, median (min) of 3 rounds of 10 s, after the profile-led fixes

contestant 16 64 256 peak RSS, MiB
db-entry 72613 (24250) 104902 (100258) 107434 (107129) 65.6
db-entry-copy 25484 (24521) 102587 (99192) 106712 (104700) 65.6
async-db 55613 (47297) 98905 (93916) 115322 (114011) 33.1

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 64.9% 64: 2.2% 256: 0.7% async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: -23.4% inside 64: -5.7% outside 256: +7.3% inside

/queries?queries=20, req/s, median (min) of 3 rounds of 10 s, after the profile-led fixes

contestant 16 64 256 peak RSS, MiB
db-entry 25005 (24747) 26334 (26214) 36489 (34628) 66.2
db-entry-copy 24938 (23799) 26729 (26609) 35874 (34204) 66.1
async-db 27700 (27458) 31429 (31041) 29922 (29336) 24.2

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 0.3% 64: 1.5% 256: 1.7% async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: +10.8% inside 64: +19.3% inside 256: -18.0% outside

/updates?queries=20, req/s, median (min) of 3 rounds of 10 s, after the profile-led fixes

contestant 16 64 256 peak RSS, MiB
db-entry 6796 (6079) 7054 (6811) 8098 (7742) 66.1
db-entry-copy 6862 (6849) 6801 (6747) 7820 (7512) 66.1
async-db 7231 (6906) 7549 (7286) 8805 (7789) 25.6

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 1.0% 64: 3.6% 256: 3.4% async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: +6.4% inside 64: +7.0% inside 256: +8.7% inside

/fortunes, req/s, median (min) of 3 rounds of 10 s, after the profile-led fixes

contestant 16 64 256 peak RSS, MiB
db-entry 59273 (56004) 71431 (70409) 72460 (70852) 65.5
db-entry-copy 58014 (56903) 71239 (70620) 71885 (70521) 65.5
async-db 40755 (38151) 63458 (61786) 40509 (39601) 24.7

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 2.1% 64: 0.3% 256: 0.8% async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: -31.2% outside 64: -11.2% outside 256: -44.1% outside

/cached-queries?count=100, req/s, median (min) of 3 rounds of 10 s, after the profile-led fixes

contestant 16 64 256 peak RSS, MiB
db-entry 63416 (62559) 69900 (69102) 69778 (68378) 65.4
db-entry-copy 63652 (62930) 70618 (70062) 71740 (68509) 65.4
async-db 68592 (68369) 83261 (78516) 81876 (81556) 18.7

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 0.4% 64: 1.0% 256: 2.8% async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: +8.2% inside 64: +19.1% inside 256: +17.3% inside

  • /plaintext c=16384 round 1: async had 0 Non-2xx responses and socket errors c/r/w/t 0/5955/0/0
  • /plaintext c=16384 round 2: async had 0 Non-2xx responses and socket errors c/r/w/t 0/4570/0/0
  • /plaintext c=16384 round 3: async had 0 Non-2xx responses and socket errors c/r/w/t 0/4249/0/0

No database cell has a *, and neither explicit build has one anywhere. The async entry's read errors at 16,384 connections, in every round as on 2026-11-11, are still not looked into.

Memory. On plaintext and json the async entry's peak RSS is where it was on 2026-11-11 (95.8 MiB against the explicit entry's 91.4, and 7.6 against 3.3). On the database tests it stays below the explicit entry's (18.7–33.1 against 65.4–66.2 MiB), but /db's rose from 22.6 to 33.1 MiB, which follows #1419's batching of concurrent ids into one statement; that is inferred from the timing, not traced.

What remains, as far as this run and the profiles go. No new profile was taken for this run; #1459's callgrind tables, on its head, are the latest (its PR body has them). Per request, the async entry still runs about 3,100 (plaintext) and 3,300 (json) more instructions than the explicit one, about 8,500 against 5,400 and 9,900 against 6,600. About 750 of it is the task's memory in runtime/runtime-async.c (malloc/free of the frame and region, nish_async_spawn, nish_async_done, nish_arena_release), not the per-wait system calls #1374 ruled out; about 2,100 is the layered hand-off from serveOn through HttpHandler to serveTask and the router's walk; about 190 (plaintext) and 450 (json) is shared std/net/http1-server.ts and JSON-writer code. The database tests' remaining gap was not profiled after #1419.

TechEmpower: the gate's baseline checked and re-measured (WP49 stage 6)

The same gate as the re-measurement after the profile-led fixes, run on main to answer one question and to give the next fixes their before: since #1448 bench/techempower/main.ts forks one worker a core when it is given no worker count, run.sh gives entry and entry-copy none, and async-main.ts is always one process. Is the gate still one worker against one worker?

It is, and it was in the earlier runs. The default count is availableParallelism(), which reads the affinity mask, and run.sh starts every server under taskset -c 0. Each default contestant was started as run.sh starts it and read from /proc while wrk (256 connections on /json, on CPUs 1-3) loaded it: the processes in its tree, each one's Cpus_allowed_list and threads from /proc/<pid>/status, and its CPU ticks (utime + stime of /proc/<pid>/stat) 1.5 s into the load.

started as processes Cpus_allowed_list threads CPU ticks at 1.5 s
taskset -c 0 build/tfb/entry <port> (run.sh's entry) 1 0 1 147
taskset -c 0 build/tfb/entry-copy <port> (run.sh's entry-copy) 1 0 1 150
taskset -c 0 build/tfb/async <port> (run.sh's async) 1 0 1 151
taskset -c 0 build/tfb/entry <port> 1 127.0.0.1 16384 1 (the explicit count 1) 1 0 1 150
build/tfb/entry <port>, unpinned 5: a supervisor and 4 workers supervisor 0-3; workers 0, 1, 2 and 3 1 each 0; 0, 67, 68 and 66
taskset -c 0-1 build/tfb/entry <port> 3: a supervisor and 2 workers supervisor 0-1; workers 0 and 1 1 each 0; 143 and 110
NISH_WORKERS=4 taskset -c 0 build/tfb/entry <port> none: exit 1, nish/net/prefork: pin with 4 workers on 1 CPUs

So under run.sh's pinning the explicit entry serves in the process it was started in, with no supervisor and no worker, exactly as it does given the count 1, and the three contestants each have one thread on CPU 0. The last three rows are what the gate does not run: without the pin the entry is one worker a core, and with NISH_WORKERS above 1 exported it refuses to start, so run.sh exits 1 (entry did not start) and cannot compare unlike things silently. The database wrappers pass the count 1, and profile.sh starts its servers under the same taskset -c 0.

What changed in run.sh: its comment only. The header said "workers (one)" without saying what makes it one; it now says the count is main.ts's default under the pin, and what NISH_WORKERS does. The contestants' commands are the ones the earlier runs used, so the earlier sections' figures were one worker against one worker too.

Date 2026-11-12
nish build/nish built from main at 7e241d75, its head when the runs were taken (nish 0.38.0 sources), --link --profile speed
CPU Intel(R) Xeon(R) Processor @ 2.10GHz, 4 logical cores, 15 GiB
OS linux 6.18.44 (x64)
Postgres 16, a throwaway cluster in build/tfb/pg, fsync=off, TFB's world (10,000 rows) and fortune tables
Client wrk 4.1.0, TFB's request headers, --timeout 8; /plaintext through bench/techempower/pipeline.lua 16 deep
Pinning plaintext and json: server on CPU 0, wrk -t 3 on CPUs 1-3. Database: server on CPU 0, Postgres on CPU 1, wrk -t 2 on CPUs 2-3
Commands bash bench/techempower/run.sh --only plaintext, bash bench/techempower/run.sh --only json --duration 8, PG_BIN=/usr/lib/postgresql/16/bin bash bench/techempower/run.sh --only db --duration 2, each alone in the foreground; bash bench/techempower/profile.sh --only plaintext and --only json

The method, the * rule and the caveats are the first measurement's: one 4-core VM shared by wrk, Postgres and the server, a relative A/B and not a TechEmpower rank. The cells are req/s, median (minimum) of 3 interleaved rounds, and a delta d is inside when d >= −band. The rounds are shorter than the earlier runs' on two tests, because one call of this session's shell ends after ten minutes and each test ran as one call: /plaintext has the default 10 s, /json 8 s, and the five database tests 2 s. A 2 s round is a weak figure; the database rows below are a baseline for a re-run at the same --duration 2, not a replacement for the 10 s figures of the section above. The http-twins were not built, so the tables have no twin rows.

Outcome: the gate is not met on main. Seven of the eleven judged cells are outside:

test connections band async vs entry verdict after the profile-led fixes
/plaintext 256 18.3% −27.6% outside −27.7%
/plaintext 1024 8.5% −21.7% outside −15.0%
/plaintext 4096 1.2% −31.3% outside −26.9%
/plaintext 16384 1.4% −63.1% not judged (run.sh: outside*) −68.0%*
/json 16 3.0% −1.1% inside −2.0%
/json 32 0.5% −0.1% inside −0.5%
/json 64 2.9% −1.1% inside +0.5%
/json 128 7.8% −11.6% outside −4.9%
/json 256 1.6% −13.0% outside −3.6%
/json 512 4.7% −13.1% outside −13.0%
/db 16 10.2% (bimodal) +164.6% not judged (run.sh: inside) −23.4%
/db 64 2.3% −9.1% outside −5.7%
/db 256 1.6% +6.3% inside +7.3%
/queries?queries=20 16 5.3% +6.9% inside +10.8%
/queries?queries=20 64 4.1% +7.9% inside +19.3%
/queries?queries=20 256 11.2% −26.8% outside −18.0%
/updates?queries=20 16 0.7% −6.2% outside +6.4%
/updates?queries=20 64 6.3% +10.4% inside +7.0%
/updates?queries=20 256 5.5% +0.5% inside +8.7%
/fortunes 16 0.1% −27.5% outside −31.2%
/fortunes 64 1.7% −8.8% outside −11.2%
/fortunes 256 2.1% −36.2% outside −44.1%
/cached-queries?count=100 16 2.6% +5.2% inside +8.2%
/cached-queries?count=100 64 7.3% +20.2% inside +19.1%
/cached-queries?count=100 256 4.6% +9.2% inside +17.3%

The judged cells are /plaintext at 256, 1,024 and 4,096 connections, /json at all six, and /db at 64 and 256. /plaintext at 16,384 (a * cell: read errors in two of the async entry's rounds and one of entry-copy's), /db at 16 and the four other database tests are recorded and not judged.

Three cells need their rounds read:

  • /plaintext at 256 has an 18.3% band because entry-copy gave 1,003,833, 1,348,640 and 1,100,494 req/s against entry's 1,303,328, 1,408,132 and 1,346,435. The async entry gave 974,508, 990,862 and 951,813, below every explicit round of both builds, so the cell is outside however the band is read.
  • /json at 256 was inside in the section above on a 9.5% band and is outside here on a 1.6% one; the async entry's own figure moved from 175,217 to 153,178 req/s between the two runs, at 8 s rounds here. One run does not say which is the cell's level.
  • /db at 16 is bimodal as before: the explicit builds gave 22–25k req/s in five rounds and 71,908 in the sixth, and the async entry 52.7–62.8k. /db at 64 has one low explicit round, db-entry's first at 43,970 against 106,299 and 109,558; its median is not moved by it.

/plaintext, req/s, median (min) of 3 rounds of 10 s, the baseline

contestant 256 1024 4096 16384 peak RSS, MiB
entry 1346435 (1303328) 1053251 (859591) 924010 (810910) 927770 (909391) 91.9
entry-copy 1100494 (1003833) 963336 (881312) 935437 (895975) 914474 (892098)* 91.9
async 974508 (951813) 824529 (812935) 635200 (612522) 342670 (327120)* 96.3

noise band (|entry - entry-copy| / entry, medians): 256: 18.3% 1024: 8.5% 4096: 1.2% 16384: 1.4% async vs entry (median delta, inside or outside the band; * had failures, never inside): 256: -27.6% outside 1024: -21.7% outside 4096: -31.3% outside 16384: -63.1% outside*

  • /plaintext c=16384 round 1: entry-copy had 0 Non-2xx responses and socket errors c/r/w/t 0/506/0/0
  • /plaintext c=16384 round 1: async had 0 Non-2xx responses and socket errors c/r/w/t 0/4274/0/0
  • /plaintext c=16384 round 2: async had 0 Non-2xx responses and socket errors c/r/w/t 0/1071/0/0

/json, req/s, median (min) of 3 rounds of 8 s, the baseline

contestant 16 32 64 128 256 512 peak RSS, MiB
entry 104290 (102785) 126942 (126527) 142203 (130745) 161957 (160809) 175980 (174676) 179671 (171024) 3.3
entry-copy 101131 (99792) 126360 (125347) 138123 (137767) 149260 (147660) 173247 (172042) 171220 (163266) 3.3
async 103125 (96351) 126842 (125024) 140600 (139605) 143217 (138492) 153178 (152420) 156080 (138030) 7.6

noise band (|entry - entry-copy| / entry, medians): 16: 3.0% 32: 0.5% 64: 2.9% 128: 7.8% 256: 1.6% 512: 4.7% async vs entry (median delta, inside or outside the band; * had failures, never inside): 16: -1.1% inside 32: -0.1% inside 64: -1.1% inside 128: -11.6% outside 256: -13.0% outside 512: -13.1% outside

/db, req/s, median (min) of 3 rounds of 2 s, the baseline

contestant 16 64 256 peak RSS, MiB
db-entry 22920 (22195) 106299 (43970) 99740 (98747) 65.8
db-entry-copy 25251 (21649) 103804 (97747) 98111 (97196) 65.9
async-db 60655 (52712) 96584 (94913) 106024 (99975) 33.0

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 10.2% 64: 2.3% 256: 1.6% async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: +164.6% inside 64: -9.1% outside 256: +6.3% inside

/queries?queries=20, req/s, median (min) of 3 rounds of 2 s, the baseline

contestant 16 64 256 peak RSS, MiB
db-entry 24905 (23260) 25923 (25117) 37115 (34514) 66.4
db-entry-copy 23588 (23258) 26986 (25307) 32970 (32499) 66.4
async-db 26616 (26484) 27974 (26045) 27179 (26039) 23.9

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 5.3% 64: 4.1% 256: 11.2% async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: +6.9% inside 64: +7.9% inside 256: -26.8% outside

/updates?queries=20, req/s, median (min) of 3 rounds of 2 s, the baseline

contestant 16 64 256 peak RSS, MiB
db-entry 6605 (5134) 6937 (5915) 7464 (7117) 66.4
db-entry-copy 6653 (6260) 6504 (6000) 7051 (6555) 66.4
async-db 6196 (6074) 7659 (6737) 7505 (7412) 26.4

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 0.7% 64: 6.3% 256: 5.5% async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: -6.2% outside 64: +10.4% inside 256: +0.5% inside

/fortunes, req/s, median (min) of 3 rounds of 2 s, the baseline

contestant 16 64 256 peak RSS, MiB
db-entry 58866 (58191) 69660 (67888) 63482 (59310) 65.8
db-entry-copy 58907 (56579) 70855 (68616) 64831 (57930) 65.8
async-db 42652 (40783) 63551 (62057) 40511 (40463) 24.3

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 0.1% 64: 1.7% 256: 2.1% async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: -27.5% outside 64: -8.8% outside 256: -36.2% outside

/cached-queries?count=100, req/s, median (min) of 3 rounds of 2 s, the baseline

contestant 16 64 256 peak RSS, MiB
db-entry 61657 (59582) 66834 (60029) 66015 (51824) 65.7
db-entry-copy 63286 (61685) 71715 (66504) 62971 (60077) 65.7
async-db 64885 (64381) 80353 (78555) 72087 (71049) 18.4

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 2.6% 64: 7.3% 256: 4.6% async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: +5.2% inside 64: +20.2% inside 256: +9.2% inside

No database cell has a *.

Memory. Peak RSS is the server's VmHWM, the largest over every round and concurrency of the test, and is where it was: 96.3 MiB against the explicit entry's 91.9 on plaintext, 7.6 against 3.3 on json, and 18.4–33.0 against 65.7–66.4 on the database tests.

The baseline profile: instructions and system calls per request

profile.sh on the same tree, its defaults (5 s perf and strace phases, a 10 s callgrind window), one process on CPU 0 for each side as above. Instructions per request (callgrind's Ir over the responses wrk counted in the window) hold across machines and noise, so they are the figure a fix is checked against.

explicit async async − explicit
/plaintext, 256 connections, 16 pipelined: Ir per request 4,814 7,848 3,034
/plaintext: system calls per request (strace -c -f) 0.129 0.134 0.005
/plaintext: req/s under perf 1,326,148 982,824
/plaintext: server CPU µs per request, user + system 0.74 1.01
/json, 64 connections: Ir per request 5,962 9,276 3,314
/json: system calls per request (strace -c -f) 2.026 2.109 0.083
/json: req/s under perf 136,267 136,230
/json: server CPU µs per request, user + system 7.30 7.23

The responses in the callgrind windows were 343,648 and 225,104 (plaintext, explicit and async) and 155,028 and 160,147 (json); no wrk run of either profile had an error. The system calls are almost all recvfrom and sendto, one of each a request on /json and one of each for about sixteen on /plaintext. What the async entry adds over the 5 s strace window is its per-wait calls: on /plaintext 1,375 epoll_ctl, 561 close and 559 fcntl against the explicit entry's 256 epoll_ctl, over 35,711 sendto; on /json 1,301, 620 and 618 against 64, over 38,848.

The explicit entry's Ir is lower than the 5,411 (plaintext) and 6,588 (json) of #1459's tables, and the async entry's lower than its 8,507 and 9,887, with the difference between the two entries about the same (3,034 and 3,314 against about 3,100 and 3,300). What moved both was not measured; #1460's request-head parse landed on main after that head, and http1Next is in both entries. The top frames by self Ir per request:

/plaintext, explicit:

    2364.8  nish.http1Next
     887.5  nish.http1WriteResponseHead
     391.4  tfbMain$fn.16.nish_main$arrow0$fn.16.nish_main$arrow1
     338.0  TfbServer.resume
     145.4  nish.http1PutBytes
     126.9  nish.http1TakeLine
      97.8  __memcpy_avx_unaligned_erms
      77.2  nish.http1PutStatusLine
      76.2  nish.http1PutCrlf
      54.2  nish.http1PutDecimal
      50.1  nish.Http1Connection.bodyRoom
      41.1  nish.http1PutText

/plaintext, async:

    2365.5  nish.http1Next
     904.9  nish.http1WriteResponseHead
     487.8  nish.serveTask$fn.9.tfbHandle.resume
     464.2  nish.HttpHandler.drive
     454.9  nish.serveOn$fn.9.tfbHandle.resume
     295.7  nish.Router.match
     244.3  nish.HttpHandler.start
     238.4  nish.Router.walk
     214.8  __memcpy_avx_unaligned_erms
     182.0  nish_async_done
     162.9  _int_free
     145.8  nish.http1PutBytes

/json, explicit:

    2442.6  nish.http1Next
     804.3  nish.http1WriteResponseHead
     575.5  tfbMain$fn.16.nish_main$arrow0$fn.16.nish_main$arrow1
     434.2  nish.jsonWriterPutString
     339.1  TfbServer.resume
     165.1  nish.http1TakeLine
     145.1  nish.http1PutBytes
     136.1  nish.Http1Server.send
     106.0  __memcpy_avx_unaligned_erms
     100.0  nish.Http1Connection.inputRoom
      84.0  nish.Http1Connection.feed
      77.0  nish.http1PutStatusLine

/json, async:

    2436.5  nish.http1Next
     817.3  nish.http1WriteResponseHead
     646.1  nish.serveOn$fn.9.tfbHandle.resume
     544.2  nish.serveTask$fn.9.tfbHandle.resume
     530.2  nish.HttpHandler.drive
     434.1  nish.jsonWriterPutString
     249.1  nish.Router.match
     243.1  nish.HttpHandler.start
     208.1  __memcpy_avx_unaligned_erms
     181.1  nish_async_done
     172.1  nish.Http1Server.send
     165.1  nish.http1TakeLine

Until stage 6's re-measurement after task recycling (below), the gate was read against this section: a fix's before is these tables, re-run with the same commands and durations, and its Ir per request is set against the 4,814 and 7,848 (plaintext) and 5,962 and 9,276 (json) above.

TechEmpower: the gate after task recycling (WP49 stage 6)

This re-runs the gate on main after two changes.

  • Task recycling (#1493): a finished task's node keeps its region for the node's next task, so a request's task costs no malloc or free.
  • Response head (#1457): a repeated HTTP/1 response head is built once per Date tick.

The changes are library and runtime changes that serve every nish:async and serve program; nothing in bench/techempower/ moved. Two other candidates were measured and not landed, because what a user would gain does not pay for them:

  • Reading the request in place: serveTask would hand handle the connection slot's buffers in place of a copy. The language's task-memory rule refuses this: handle may grow what it is given. The copy it would save costs about 330 Ir per request.
  • A fixed-path table in Router: callgrind (valgrind 3.22.0), Ir per match.
    • On examples/http-app's routes: 506 → 491 for /health, unchanged for /notes/17.
    • On a 44-route router: 591 → 491 and 909 → 765 for fixed paths, unchanged for paths with parameters, and 527 → 570 for a 404.
Date 2026-11-13
nish build/nish built from main at 5c0cd6b2 (nish 0.38.0 sources), --link --profile speed
CPU Intel(R) Xeon(R) Processor @ 2.10GHz, 4 logical cores, 15 GiB
OS linux 6.18.44 (x64)
Postgres 16, a throwaway cluster in build/tfb/pg, as the baseline
Client wrk 4.1.0, TFB's request headers, --timeout 8; /plaintext through bench/techempower/pipeline.lua 16 deep
Pinning plaintext and json: server on CPU 0, wrk -t 3 on CPUs 1-3. Database: server on CPU 0, Postgres on CPU 1, wrk -t 2 on CPUs 2-3
Commands bash bench/techempower/run.sh --only plaintext, then --only json, then --only db, one after another with nothing else running; run.sh unchanged

Every test ran the default 3 rounds of 10 s. So /json and the database tests are at the durations of the re-measurement after the profile-led fixes, not the baseline's 8 s and 2 s. The method, the band and the * rule are unchanged. The http-twins were not built.

Outcome: the gate is not met. Four of the six cells #1468 and #1402 judge are outside the band:

The judged set is the six cells #1468 lists, narrower than the earlier sections' eleven: the cells the explicit entry's issue tracks, not every cell run.sh prints. run.sh also prints /json at 16, 64 and 256 as outside (−8.4%, −3.2%, −10.6%, in the tables below); they are recorded and not judged, as are /plaintext at 16,384, /db at 16 and 256, and the other database tests.

test connections band async vs entry verdict the baseline
/plaintext 256 1.3% −34.5% outside −27.6%
/plaintext 1024 4.4% −24.1% outside −21.7%
/plaintext 4096 2.9% −25.7% outside −31.3%
/json 128 10.0% +7.3% inside −11.6%
/json 512 3.7% −17.0% outside −13.1%
/db 64 7.9% +4.9% inside −9.1%

Reading the rounds:

  • /plaintext: every async round is below every explicit round, at all three connection counts. For example, at 256 connections the async entry gave 1,122,886 to 1,131,320 req/s, and entry and entry-copy gave 1,626,321 to 1,730,805. The cells are outside however the band is read. #1457 builds the head once per tick for both entries, so it does not narrow the gap. At 4,096 connections the delta moved from −31.3% to −25.7%, and at 256 it moved from −27.6% to −34.5%, so this run does not show a trend.
  • /json at 128: the async entry gave 182,829 to 185,514 req/s, inside the explicit rounds' 170,948 to 192,047. The cell is inside on its rounds as well as on its median.
  • /json at 512: entry is bimodal (166,056, 215,934 and 217,296 req/s). The async entry's best round, 181,014, is below every entry-copy round (191,532 to 218,709). The cell is outside.
  • /db at 64: this cell also has one low explicit round, db-entry's first, at 22,253 against 108,106 and 113,153. That widens the band to 7.9%. The async entry's rounds, 112,066 to 119,750, overlap the range of the other five explicit rounds (106,555 to 119,548), and its lowest round is above their lowest, so the cell is inside whichever way it is read. /db at 16 is bimodal again and is not judged.

/plaintext, req/s, median (min) of 3 rounds of 10 s, after task recycling

contestant 256 1024 4096 16384 peak RSS, MiB
entry 1723784 (1683348) 1398714 (1088063) 1053287 (886782) 1201865 (1147809) 113.7
entry-copy 1701240 (1626321) 1336745 (1180980) 1084149 (925269) 1189346 (831549) 113.7
async 1129843 (1122886) 1062193 (989761) 782668 (768754) 481322 (447762)* 116.2

noise band (|entry - entry-copy| / entry, medians): 256: 1.3% 1024: 4.4% 4096: 2.9% 16384: 1.0% async vs entry (median delta, inside or outside the band; * had failures, never inside): 256: -34.5% outside 1024: -24.1% outside 4096: -25.7% outside 16384: -60.0% outside*

  • /plaintext c=16384 round 1: async had 0 Non-2xx responses and socket errors c/r/w/t 0/4326/0/0
  • /plaintext c=16384 round 3: async had 0 Non-2xx responses and socket errors c/r/w/t 0/9077/0/0

/json, req/s, median (min) of 3 rounds of 10 s, after task recycling

contestant 16 32 64 128 256 512 peak RSS, MiB
entry 126307 (123684) 144399 (138584) 171651 (165998) 172369 (170948) 206515 (142150) 215934 (166056) 3.9
entry-copy 125005 (123433) 144378 (138054) 167802 (159413) 189582 (182134) 210275 (204847) 207983 (191532) 3.9
async 115726 (115085) 144457 (141874) 166213 (157581) 184928 (182829) 184559 (184372) 179200 (174695) 8.3

noise band (|entry - entry-copy| / entry, medians): 16: 1.0% 32: 0.0% 64: 2.2% 128: 10.0% 256: 1.8% 512: 3.7% async vs entry (median delta, inside or outside the band; * had failures, never inside): 16: -8.4% outside 32: +0.0% inside 64: -3.2% outside 128: +7.3% inside 256: -10.6% outside 512: -17.0% outside

/db, req/s, median (min) of 3 rounds of 10 s, after task recycling

contestant 16 64 256 peak RSS, MiB
db-entry 21404 (21026) 108106 (22253) 124419 (123313) 66.2
db-entry-copy 21323 (20756) 116677 (106555) 126312 (125950) 66.2
async-db 72482 (59505) 113355 (112066) 135956 (131814) 36.8

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 0.4% 64: 7.9% 256: 1.5% async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: +238.6% inside 64: +4.9% inside 256: +9.3% inside

The other database tests, after task recycling

These are recorded, not judged. Each cell is the async-db median against db-entry's, with the band in brackets, from 3 rounds of 10 s.

test 16 64 256
/queries?queries=20 +3.4% (2.7%) +13.8% (3.0%) −13.4% (0.7%)
/updates?queries=20 +3.3% (1.7%) +6.4% (0.3%) +11.3% (1.2%)
/fortunes −35.6% (1.2%) −21.5% (0.3%) −48.4% (0.5%)
/cached-queries?count=100 +13.7% (2.0%) +12.6% (3.6%) +29.6% (1.2%)

What is left. The gap on /plaintext and on /json at 512 connections is the per-request work the async path does and the explicit one does not. The baseline profile measured it at 7,848 against 4,814 instructions on plaintext. #1493 then took off about 520 on plaintext and about 490 on json. WP49 §6 puts the rest in the serve, handler and router hand-off. The two library candidates above would together save less than 500 instructions a request, on a gap of more than 2,500. Closing the gap needs a change to that hand-off's design: for example, no spawned task per request, or a language rule that lets a task lend its connection's buffers to handle. That is a design decision, not a library fix.

TechEmpower: the gate after the hand-off build (WP49 stage 6)

This re-runs the gate after #1601, which has serve drive the HTTP/1 server directly instead of through HttpHandler: a connection's Http1Connection reads the next request and writes the answer, and the HttpHandler layer is gone from the async path. Three other changes landed on main between the last measurement and #1601, and they move the explicit entry too, so the before was re-measured in the same container rather than read from that section:

  • The router (#1596, 2fc0f205): its own figures were 6,502 → 6,470 Ir a request on TFB's async plaintext and 8,223 → 8,203 on json, and 8% to 22% less per match.
  • The JSON tokenizer (#1600, fb4b625e) and a codegen change (#1597).

#1601's own figures were 6,520 → 6,374 Ir a request on async plaintext and 8,229 → 8,122 on json, with the async entry's peak RSS at plaintext 16,384 connections up from 26.2 to 32.5 MiB.

The before is main at 7699d971 (#1596, #1597 and #1600 in; #1601 not), the after is main at e9730272 (#1601 in). Both were built and measured here, one after the other, with bench/techempower/run.sh and profile.sh unchanged.

Date 2026-11-14
nish before: build/nish built from main at 7699d9711f43f328ff44cd913f39cc9173422f7d; after: from main at e973027284e922c6f6251116ece8b8ebeb409703; each npm ci && npm run build from the 0.39.0 seed, --link --profile speed
CPU Intel(R) Xeon(R) Processor @ 2.10GHz, 4 logical cores, 15 GiB
OS linux 6.18.44 (x64)
Postgres 16 (Ubuntu's package), a throwaway cluster in build/tfb/pg, as the baseline
Client wrk 4.1.0, TFB's request headers, --timeout 8; /plaintext through bench/techempower/pipeline.lua 16 deep
Pinning plaintext and json: server on CPU 0, wrk -t 3 on CPUs 1-3. Database: server on CPU 0, Postgres on CPU 1, wrk -t 2 on CPUs 2-3
Commands in each tree, bash bench/techempower/run.sh --only plaintext, then --only json, then --only db, before then after for each test, one run at a time with nothing else running; then bash bench/techempower/profile.sh --only plaintext and --only json in each tree (perf 6.8.12, valgrind 3.22.0)

Every test ran the default 3 rounds of 10 s. The method, the band and the * rule are unchanged. The judged set is the eleven cells of the re-measurement after the profile-led fixes: /plaintext at 256, 1,024 and 4,096 connections, /json at 16 to 512, and /db at 64 and 256. A cell is inside when the async median's delta is no worse than minus its band. /plaintext at 16,384 (*, socket errors), /db at 16 (bimodal) and the other database tests are recorded, not judged. A judged cell whose explicit pair is bimodal had its test re-run once, and is not judgeable if the re-run is bimodal too. Which verdict counts: a cell whose explicit pair was bimodal in the first run takes the re-run's verdict (/plaintext at 4,096, outside in both); every other cell of a re-run test keeps the first run's verdict, because its first run was judgeable, and the re-run's reading is reported beside it, not counted (/plaintext at 1,024 and /json at 16, inside on the re-run; /json at 32, outside on the re-run).

Outcome: the gate is not met. Four of the eleven judged cells are inside (/json at 32 and 64, /db at 64 and 256), six are outside, and /json at 512 is not judgeable. #1601 moved the async entry up on every /plaintext and /db cell and on five of six /json cells, and took about 160 Ir a request off plaintext and about 110 off json; the async entry still spends about 2,040 more instructions a request than the explicit one on plaintext and about 2,430 more on json. One recorded cell got worse than before by more than its band under either band: /queries?queries=20 at 64 connections, whose async median fell 9.3% (31,287 → 28,382) against bands of 1.5% before and 9.2% after. The full test is below.

test connections band before async vs entry, before band after async vs entry, after verdict
/plaintext 256 3.1% −29.9% 6.2% −24.5% outside
/plaintext 1024 5.6% −23.0% 1.7% −20.4% outside
/plaintext 4096 5.1% −36.0% 3.6% (bimodal; re-run 13.5%) −35.7% (re-run −20.5%) outside (re-run's verdict)
/json 16 6.2% −7.1% 1.3% −3.6% outside
/json 32 1.4% −7.4% 1.8% +3.2% inside
/json 64 2.2% −3.9% 3.8% −0.0% inside
/json 128 2.4% −5.0% 2.8% −5.4% outside
/json 256 0.2% −10.2% 5.2% −9.0% outside
/json 512 3.8% −7.8% 0.6% (bimodal; re-run 1.3%, bimodal) −13.7% (re-run −4.1%) not judgeable
/db 64 2.8% −2.0% 10.3% +6.4% inside
/db 256 3.0% +7.3% 6.8% +17.1% inside

Reading the rounds:

  • /plaintext: every async round is below every explicit round at 256, 1,024 and 4,096 connections in both runs. After: 1,084,891 to 1,239,279 req/s against 1,549,796 to 1,719,822 at 256; 1,028,145 to 1,079,068 against 1,262,270 to 1,473,896 at 1,024; 702,681 to 796,859 against 922,313 to 1,186,618 at 4,096. The 4,096 cell had one low entry round (922,313), so /plaintext was re-run. The re-run was about 10% slower for every contestant, and gave −27.7% (band 3.3%), −15.9% (19.7%) and −20.5% (13.5%). The re-run's 4,096 explicit pair is not bimodal (entry 841,510 to 993,189, entry-copy 949,917 to 1,004,542), so the cell takes the re-run's verdict, outside, the same as the first run's. Its 1,024 cell reads inside only because the explicit pair split (every entry-copy round above every entry round); every async round there (820,692 to 998,225) is still below every explicit one. The first run's 1,024 pair was not bimodal, so the first run's verdict, outside, counts.
  • /json at 16, 128 and 256: at 128 and 256 every async round is below every explicit round (164,791 to 173,952 against 174,564 to 182,967 at 128; 171,641 to 178,853 against 186,279 to 200,277 at 256). At 16 the async rounds (106,052 to 113,283) overlap the explicit ones (110,885 to 117,375) but the median is 3.6% below on a 1.3% band; the re-run read it inside (−2.5% on 3.4%), so it is the closest of the outside cells. Its first-run explicit pair (111,991 to 117,375 and 110,885 to 114,404) is not bimodal, and /json was re-run for 512, so the first run's verdict counts.
  • /json at 32 and 64: the async rounds (122,634 to 126,514; 142,419 to 144,626) are inside the explicit rounds' range (113,402 to 131,481; 138,462 to 152,230). Inside on rounds as well as on medians. The re-run held 64 inside (+0.2%) and put 32 at −4.0% on a 0.8% band.
  • /json at 512: entry gave 198,218, 162,448 and 190,619 req/s, one round far below the other two, so the test was re-run. The re-run's entry was bimodal again (126,655 against about 168,000 to 176,000), and the async entry had one round of 67,576. The cell is not judgeable. In the first run every async round (163,490 to 165,939) was below every explicit round but the low one (178,956 to 198,218); in the re-run the async entry's two normal rounds (161,343 and 166,073) overlap the explicit ones (163,726 to 176,011).
  • /db at 64: the async rounds (102,568 to 108,480) sit inside the explicit range (98,596 to 112,089). At 256 every async round (121,483 to 124,649) is above every explicit round (98,569 to 113,292). /db at 16 is bimodal again (db-entry 27,390, 31,891 and 70,576; db-entry-copy 20,017, 26,032 and 73,443) and is not judged.

Worse than before by more than its band. The test: a cell is worse than before by more than its band when its async median's change, before → after, is below minus the band. Each cell has two bands, the before run's and the after run's, so the test is applied with both and every judged and recorded cell is listed below with the readings that flag it. The changes are exact; the bands are as the tables show them.

  • No judged cell is flagged. The async medians rose on /plaintext (+2.3%, +5.9%, +5.3% at 256, 1,024, 4,096), on /json at 16 to 256 (+0.5% to +8.3%) and on /db (+3.6% at 64, +7.4% at 256).
  • Beyond both bands, recorded: /queries?queries=20 at 64 connections, 31,287 → 28,382 (−9.3%; bands 1.5% before, 9.2% after). This is flagged under any reading of the rule, and it is a recorded database cell, which may not get worse than before by more than its band.
  • Beyond the before band only:
    • /queries?queries=20 at 256, 30,373 → 27,997 (−7.8%; bands 3.9%, 8.9%);
    • /updates?queries=20 at 16, 7,088 → 6,900 (−2.7%; bands 0.4%, 6.5%);
    • /plaintext at 16,384 (*, recorded), 362,870 → 351,913 (−3.0%; bands 1.1%, 10.4%);
    • /fortunes at 64, 65,385 → 65,241 (−0.22%; bands 0.16% before, shown 0.2%, and 2.4% after).
  • Beyond the after band only: /json at 512, not judgeable, 166,893 → 164,452 (−1.5%; bands 3.8%, 0.6%).
  • Within both: /fortunes at 256 (−3.2%; 4.9%, 5.0%) and /cached-queries?count=100 at 256 (−0.3%; 9.6%, 7.2%). Every other recorded cell rose: /db at 16, /queries at 16, /updates at 64 and 256, /fortunes at 16, /cached-queries at 16 and 64.

Measured against the explicit entry rather than against itself, /json at 512 (−7.8% → −13.7%), /updates at 64 and 256 (−4.6 and −4.5 points) and /fortunes at 16 (−1.5 points) moved down by more than the after band. In each the explicit entry moved up as much as the async one moved down, and none is judged.

The peak RSS of the async entry at /plaintext rose from 26.1 to 32.5 MiB in this run; #1601 reported 26.2 to 32.5.

The profile: instructions per request, before and after

bench/techempower/profile.sh, unchanged, in each tree: callgrind Ir per request, strace -c system calls per request, and perf record -e cpu-clock:u CPU per request, at its defaults (plaintext 256 connections 16 pipelined, json 64).

test Ir per request, explicit / async, before after async − explicit, before → after
plaintext 4,289 / 6,516 4,310 / 6,353 2,227 → 2,043
json 5,676 / 8,215 5,676 / 8,105 2,539 → 2,429

These differ from #1601's own figures (async 6,520 → 6,374 on plaintext and 8,229 → 8,122 on json) because both were measured on different builds in different containers: #1601's before was its own merge base and its after its branch head, where this before is main at 7699d971 and this after is main at e9730272, each built here from the 0.39.0 seed. The changes agree in sign and size: −163 here against −146 there on plaintext, −110 against −107 on json.

After, system calls per request are 0.129 explicit and 0.135 async on plaintext (0.006 more), and 2.027 and 2.109 on json (0.082 more); CPU per request is 0.67 and 0.90 µs on plaintext, 7.20 and 7.05 µs on json. The gap is user-space instructions, not system calls.

Where the gap is, as self Ir per request summed by group from callgrind.self, async minus explicit:

group plaintext before after json before after
serve: serveOn and serveTask resumes, then HttpHandler.* (before) or ServeConns.* (after) +1,828 +1,604 +2,296 +2,058
Router.match and Router.walk +430 +429 +327 +327
codec and connection: http1*, Http1Connection.*, HttpRequest, memcpy, JSON writer +170 +278 +422 +610
libc and other +245 +183 +219 +159
the handler (tfbText, tfbJson) +141 +141 +65 +65
task region (nish_region_enter, nish_region_leave, arena) +115 +115 +114 +114
executor (nish_async_*) +109 +109 +111 +111
the explicit loop and its inlined handler (TfbServer.resume, nish_main's arrow) −812 −815 −1,015 −1,015

#1601 took about 225 a request out of the serve group on both tests, and moved some of it into the connection: Http1Connection.nextRequest (133 on plaintext, 155 on json) and Http1Connection.write now do what HttpHandler did. The router, the task region, the executor and the handler are unchanged.

The top async frames after, self Ir per request on plaintext: http1Next 2,341 (2,352 explicit), serveOn's resume of tfbHandle 459, serveTask's 432, Router.match 429, ServeConns.send 401, urlIsHostPort 392 (392 explicit), http1ServerKept 304 (305 explicit), ServeConns.drive 237, Http1Connection.nextRequest 133, http1ServerSame4 127, http1TakeLine 121, memcpy 110, Http1Connection.write 93, tfbText 75, nish_async_done 66, ServeConns.enqueue 65, HttpRequest.constructor 65, nish_region_enter 59, nish_region_leave 55. Before, HttpHandler.drive 368, HttpHandler.start 342, HttpHandler.end 92, HttpHandler.put 79 and memcpy 171 stood where the ServeConns frames are. The explicit entry's own dispatch is TfbServer.resume 448 and nish_main's arrow 367. On json the async entry's largest are serveOn's resume 648, serveTask's 489, jsonWriterPutString 434, ServeConns.send 399, Router.match 327, ServeConns.drive 298, Http1Connection.nextRequest 155 and ServeConns.settle 122 (before: HttpHandler.drive 434, HttpHandler.start 340, HttpHandler.settle 134); the explicit entry's are nish_main's arrow 568 and TfbServer.resume 448.

/plaintext, req/s, median (min) of 3 rounds of 10 s, before the hand-off build

contestant 256 1024 4096 16384 peak RSS, MiB
entry 1636262 (1602216) 1276553 (1233053) 1106238 (1089620) 1185166 (1072470) 21.4
entry-copy 1687596 (1511787) 1204882 (951752) 1162348 (998030) 1171566 (1014380)* 21.4
async 1147245 (1113047) 982568 (914209) 708476 (697353) 362870 (350716)* 26.1

noise band (|entry - entry-copy| / entry, medians): 256: 3.1% 1024: 5.6% 4096: 5.1% 16384: 1.1% async vs entry (median delta, inside or outside the band; * had failures, never inside): 256: -29.9% outside 1024: -23.0% outside 4096: -36.0% outside 16384: -69.4% outside*

  • /plaintext c=16384: socket read errors in async rounds 1 to 3 (4215, 58, 4213) and in entry-copy round 2 (122)

/plaintext, req/s, median (min) of 3 rounds of 10 s, after the hand-off build

contestant 256 1024 4096 16384 peak RSS, MiB
entry 1553826 (1549796) 1307928 (1272804) 1159651 (922313) 945955 (882296) 21.4
entry-copy 1649749 (1611031) 1285926 (1262270) 1117526 (993874) 1044238 (997938)* 21.4
async 1173289 (1084891) 1040771 (1028145) 746202 (702681) 351913 (326869)* 32.5

noise band (|entry - entry-copy| / entry, medians): 256: 6.2% 1024: 1.7% 4096: 3.6% 16384: 10.4% async vs entry (median delta, inside or outside the band; * had failures, never inside): 256: -24.5% outside 1024: -20.4% outside 4096: -35.7% outside 16384: -62.8% outside*

  • /plaintext c=16384: socket read errors in async rounds 1 to 3 (3645, 5000, 4228) and in entry-copy round 2 (122)

The re-run, after:

contestant 256 1024 4096 16384 peak RSS, MiB
entry 1420288 (1379547) 1127244 (1099761) 880065 (841510) 917895 (823558) 21.4
entry-copy 1467501 (1446122) 1349346 (1286104) 999135 (949917) 910089 (763604) 21.4
async 1027150 (1020390) 948397 (820692) 699320 (655563) 331172 (299208)* 32.4

noise band (|entry - entry-copy| / entry, medians): 256: 3.3% 1024: 19.7% 4096: 13.5% 16384: 0.9% async vs entry (median delta, inside or outside the band; * had failures, never inside): 256: -27.7% outside 1024: -15.9% inside 4096: -20.5% outside 16384: -63.9% outside*

/json, req/s, median (min) of 3 rounds of 10 s, before the hand-off build

contestant 16 32 64 128 256 512 peak RSS, MiB
entry 111311 (105483) 131260 (117712) 145568 (144384) 166188 (162476) 190149 (168284) 181086 (179648) 2.7
entry-copy 104433 (103587) 129478 (114968) 142417 (139782) 170110 (160983) 189770 (157876) 187955 (172223) 2.7
async 103462 (103234) 121524 (120372) 139851 (134042) 157853 (156932) 170833 (159219) 166893 (166608) 7.2

noise band (|entry - entry-copy| / entry, medians): 16: 6.2% 32: 1.4% 64: 2.2% 128: 2.4% 256: 0.2% 512: 3.8% async vs entry (median delta, inside or outside the band; * had failures, never inside): 16: -7.1% outside 32: -7.4% outside 64: -3.9% outside 128: -5.0% outside 256: -10.2% outside 512: -7.8% outside

/json, req/s, median (min) of 3 rounds of 10 s, after the hand-off build

contestant 16 32 64 128 256 512 peak RSS, MiB
entry 114494 (111991) 122452 (113402) 142933 (140824) 180593 (174564) 188746 (186279) 190619 (162448) 2.7
entry-copy 112971 (110885) 124638 (123523) 148333 (138462) 175533 (175211) 198481 (189289) 191752 (178956) 2.7
async 110345 (106052) 126378 (122634) 142929 (142419) 170907 (164791) 171674 (171641) 164452 (163490) 7.2

noise band (|entry - entry-copy| / entry, medians): 16: 1.3% 32: 1.8% 64: 3.8% 128: 2.8% 256: 5.2% 512: 0.6% async vs entry (median delta, inside or outside the band; * had failures, never inside): 16: -3.6% outside 32: +3.2% inside 64: -0.0% inside 128: -5.4% outside 256: -9.0% outside 512: -13.7% outside

The re-run, after:

contestant 16 32 64 128 256 512 peak RSS, MiB
entry 98059 (96556) 122477 (116186) 130021 (128070) 163575 (158115) 179831 (175423) 168318 (126655) 2.7
entry-copy 101382 (92906) 121442 (100121) 133937 (123517) 153119 (152782) 185703 (184754) 170518 (163726) 2.7
async 95629 (93791) 117605 (115698) 130321 (126540) 147805 (131411) 160798 (155953) 161343 (67576) 7.2

noise band (|entry - entry-copy| / entry, medians): 16: 3.4% 32: 0.8% 64: 3.0% 128: 6.4% 256: 3.3% 512: 1.3% async vs entry (median delta, inside or outside the band; * had failures, never inside): 16: -2.5% inside 32: -4.0% outside 64: +0.2% inside 128: -9.6% outside 256: -10.6% outside 512: -4.1% outside

/db, req/s, median (min) of 3 rounds of 10 s, before and after the hand-off build

contestant 16 64 256 peak RSS, MiB
db-entry, before 29655 (26736) 106342 (105805) 106345 (105632) 66.0
db-entry-copy, before 22777 (22274) 103382 (101624) 109548 (108601) 66.0
async-db, before 55109 (45690) 104208 (97640) 114090 (113310) 40.8
db-entry, after 31891 (27390) 101473 (98596) 104676 (99451) 66.0
db-entry-copy, after 26032 (20017) 111935 (111016) 111782 (98569) 66.0
async-db, after 59615 (53347) 107973 (102568) 122526 (121483) 36.5

Before: band 23.2%, 2.8%, 3.0%; async-db vs db-entry +85.8%, −2.0%, +7.3%. After: band 18.4%, 10.3%, 6.8%; async-db vs db-entry +86.9%, +6.4%, +17.1%. /db at 16 is bimodal on both sides and not judged.

The other database tests, before and after the hand-off build

These are recorded, not judged. Each cell is the async-db median against db-entry's, with the band in brackets, from 3 rounds of 10 s, before → after.

test 16 64 256
/queries?queries=20 +0.9% (0.3%) → +10.5% (5.4%) +13.0% (1.5%) → +22.2% (9.2%) −18.7% (3.9%) → −16.5% (8.9%)
/updates?queries=20 −0.9% (0.4%) → −0.2% (6.5%) +10.9% (4.2%) → +6.3% (2.5%) +10.8% (1.0%) → +6.3% (4.2%)
/fortunes −28.1% (4.2%) → −29.6% (1.4%) −10.6% (0.2%) → −10.7% (2.4%) −42.3% (4.9%) → −47.3% (5.0%)
/cached-queries?count=100 +5.1% (8.7%) → +1.2% (7.1%) +7.8% (7.4%) → +28.9% (6.1%) +8.9% (9.6%) → +6.6% (7.2%)

The async-db medians, before → after: /queries 25,848, 31,287, 30,373 → 26,517, 28,382, 27,997; /updates 7,088, 7,665, 8,787 → 6,900, 7,835, 8,989; /fortunes 42,449, 65,385, 38,606 → 43,229, 65,241, 37,355; /cached-queries 66,350, 74,238, 80,945 → 68,036, 88,056, 80,664.

What is left. By cell: /plaintext is 20% to 36% below the explicit entry at 256 to 4,096 connections against bands of 1.7% to 6.2%, and /json is 3.6% to 9.0% below at 16, 128 and 256 against bands of 1.3% to 5.2%; /json at 512 cannot be judged in this container. By frame: the async entry runs 2,043 more instructions a request than the explicit one on plaintext and 2,429 more on json, down from 2,227 and 2,539. Net of the explicit loop's own dispatch (about 815 and 1,015), the serve layer (serveOn's and serveTask's resumes and ServeConns) is still about 1,600 and 2,060 of it, the router about 430 and 330, and the task region and executor about 225. Taking the HttpHandler layer out was one step of the hand-off redesign WP49 §6 calls for; the two resumes per request and the router's walk are the rest of it.

TechEmpower: the gate after the resume build (WP49 stage 6)

This re-runs the gate after #1621, which cuts serve's answer path and holds a request record only from parse to copy. #1621's own figures were −0.8% Ir a request on the async entry and −17% peak RSS at /plaintext 16,384 connections. The before is main at 79b2ea4e (#1621's parent), the after is main at 798636cb (#1621 in). Both were built and measured here, one after the other, with bench/techempower/run.sh unchanged. profile.sh was not re-run. The frame figures below are the #1468 profile's.

Date 2026-11-14
nish before: build/nish built from main at 79b2ea4e99fdf5b0cee8df6b145f9bc3ae198dff; after: from main at 798636cb78a8f715c0d34d067c7013caf84f6732; each npm ci && npm run build from the 0.39.0 seed, --link --profile speed
CPU Intel(R) Xeon(R) Processor @ 2.10GHz, 4 logical cores, 15 GiB
OS linux 6.18.44 (x64)
Postgres 16 (Ubuntu's package), a throwaway cluster in build/tfb/pg, removed before every --only db run
Client wrk 4.1.0 (Debian 4.1.0-4build2), TFB's request headers, --timeout 8; /plaintext through bench/techempower/pipeline.lua 16 deep
Pinning plaintext and json: server on CPU 0, wrk -t 3 on CPUs 1-3. Database: server on CPU 0, Postgres on CPU 1, wrk -t 2 on CPUs 2-3
Commands in each tree, bash bench/techempower/run.sh --only plaintext, --only json and --only db, in the foreground, one run at a time with nothing else running; each test that had a bimodal judged cell was run once more in the same tree

Every test ran the default 3 rounds of 10 s. The method, the band, the * rule and the judged set are as in the hand-off build's measurement. A judged cell is inside when the async median's delta is no worse than minus its band, and a * cell is never inside. A contestant is bimodal when one of its three rounds sits more than 15% from both others while those two are within 10% of each other. A judged cell whose explicit pair (entry and entry-copy, or db-entry and db-entry-copy) is bimodal had its test re-run once. If the re-run is bimodal too, the cell is not judgeable. A cell bimodal in the first run takes the re-run's verdict. Every other cell keeps the first run's verdict, and the re-run's reading is reported beside it, not counted.

Every test was re-run on both sides: /plaintext, /json and /db each had at least one bimodal judged cell in the first run of at least one tree. This container's bands were wide in this session. They reach 17% to 22% on /plaintext 1,024 and 33% on /json 256 (before's re-run). Read the deltas as this container's, on this day.

Outcome: the gate is not met. Four of the eleven judged cells are inside after #1621 (/json at 64 and 128, /db at 64 and 256), five are outside (/plaintext at 256, 1,024 and 4,096, /json at 16 and 256), and two are not judgeable (/json at 32 and 512). Before #1621 the same rule gave six inside, three outside and two not judgeable. Cells moved both ways, and in most of them the move is within the bands of this session. The async entry's peak RSS at /plaintext 16,384 connections fell from 32.4 to 26.9 MiB (−17%; re-runs 32.5 and 27.0). The explicit entries stayed at 21.4 MiB.

test connections band before async vs entry, before verdict before band after async vs entry, after verdict after
/plaintext 256 11.6% (bimodal; re-run 9.2%, bimodal) −29.6% (re-run −23.8%) not judgeable 11.8% (bimodal; re-run 5.0%) −17.5% (re-run −24.2%) outside (re-run's verdict)
/plaintext 1024 21.2% (bimodal; re-run 14.4%, bimodal) −33.9% (re-run −16.0%) not judgeable 17.3% (bimodal; re-run 21.9%) −3.4% (re-run −28.7%) outside (re-run's verdict)
/plaintext 4096 7.0% (bimodal; re-run 8.2%) −29.4% (re-run −30.6%) outside (re-run's verdict) 0.2% −26.7% (re-run −20.9%) outside
/json 16 3.2% +4.1% inside 13.3% −14.8% (re-run −7.2% on 1.3%) outside
/json 32 4.9% (bimodal; re-run 1.2%) −16.0% (re-run −3.9%) outside (re-run's verdict) 10.5% (bimodal; re-run 7.2%, bimodal) −5.9% (re-run −11.4%) not judgeable
/json 64 10.6% −15.9% outside 15.5% (bimodal; re-run 11.4%) −6.5% (re-run −0.6%) inside (re-run's verdict)
/json 128 5.1% +0.2% inside 22.7% (bimodal; re-run 9.8%) +1.6% (re-run −4.6%) inside (re-run's verdict)
/json 256 3.6% −1.9% inside 0.1% (bimodal; re-run 14.8%) +6.9% (re-run −28.0%) outside (re-run's verdict)
/json 512 17.2% +22.8% inside 14.4% (bimodal; re-run 16.8%, bimodal) −22.9% (re-run −2.4%) not judgeable
/db 64 2.4% +8.5% inside 25.8% (bimodal; re-run 10.8%) +48.7% (re-run +9.6%) inside (re-run's verdict)
/db 256 14.8% (bimodal; re-run 16.6%) −1.8% (re-run −0.7%) inside (re-run's verdict) 7.0% −3.4% (re-run +7.1%) inside

Reading the rounds:

  • /plaintext:
    • After, in the runs that count, every async round is below every explicit round at 256 and 4,096 connections:
      • at 256 (the re-run), 1,255,793 to 1,462,009 req/s against 1,534,036 to 2,208,093;
      • at 4,096 (the first run), 803,969 to 843,333 against 1,001,300 to 1,165,994.
    • At 1,024 the re-run's async rounds (1,082,711 to 1,269,161) overlap the low explicit ones (1,041,614 and 1,216,946), but the median is 28.7% below on a 21.9% band.
    • The first run's −3.4% at 1,024 came from a bimodal entry-copy: one round of 1,033,572 against 1,449,359 and 1,505,458. At 256 the bimodal contestant was entry, with 2,128,329 against 1,503,842 and 1,597,130.
    • Before, the explicit pair was bimodal at 256 and 1,024 in both runs, so those two cells cannot be judged on the before side. The async medians there were 16% to 34% below the explicit ones across the four readings.
  • /json:
    • The first run after #1621 had a bimodal explicit pair at 32, 64, 128, 256 and 512. Each had one round far from the other two:
      • low rounds of 126,214 (entry, 32), 128,290 (entry, 64) and 161,738 (entry, 512);
      • high rounds of 204,623 (entry-copy, 64), 223,867 (entry-copy, 128) and 261,089 (entry, 256).
    • The re-run settled 64 (−0.6% on 11.4%), 128 (−4.6% on 9.8%) and 256 (−28.0% on 14.8%). At 256 every async round (155,680 to 174,047) is below every explicit round but one entry round of 137,417.
    • 32 and 512 were bimodal again.
    • 16 was not bimodal in the first run and counts as outside (−14.8% on 13.3%). The re-run read −7.2% on 1.3%.
  • /db:
    • At 64 the after's first run had both explicit contestants bimodal. The re-run gave +9.6% on a 10.8% band, inside.
    • At 256 the first run was judgeable, −3.4% on 7.0%, inside.
    • Before, 64 was judgeable, +8.5% on 2.4%. Its rounds were wide but not bimodal by the rule: db-entry 35,429, 95,718 and 133,513; db-entry-copy 48,015, 98,031 and 114,248.
    • Before, 256's db-entry-copy was bimodal (145,964 against 108,585 and 103,642). The re-run read −0.7% on 16.6%, inside.
    • /db at 16 is bimodal in three of the four runs and is recorded, not judged.

Worse than before by more than its band. The rule and the test are those of the hand-off build's measurement. Each cell is compared first run to first run, with both bands.

  • Judged cells:
    • /plaintext at 4,096 went 840,709 → 829,515 (−1.3%), beyond only the after band of 0.2%.
    • /json at 512 went 188,319 → 158,514 (−15.8%), beyond only the after band of 14.4%. It is not judgeable on the after side.
    • Every other judged cell's async median rose or fell by less than both bands.
  • Recorded, beyond both bands:
    • /updates?queries=20 at 64: 9,881 → 9,483 (−4.0%; bands 3.3%, 1.9%).
    • /updates?queries=20 at 256: 11,071 → 10,673 (−3.6%; bands 0.0%, 0.5%).
    • Neither held in the re-runs, which read 9,017 → 10,571 and 9,896 → 11,132, both up. A flag that reverses on a re-run is this container's noise, not a regression. They are recorded here.
  • Recorded, beyond one band:
    • /fortunes at 16: −4.9%, before band 0.5%.
    • /cached-queries?count=100 at 16 and 64: −3.9% and −3.6%, after bands 1.2% and 0.9%.

Where the gap is

profile.sh was not re-run for this measurement. These are the #1468 profile's callgrind figures, self Ir a request at profile.sh's defaults.

The async entry runs about 2,054 more instructions a request than the explicit one on plaintext and 2,425 more on json. By frame (plaintext, then json), the gap is:

  • The structural cost of a second task, about 424 and 426. serveOn's resume of the handler, the task region's enter and leave, and the executor's bookkeeping.
  • Router.match, about 455 and 348. The explicit entry dispatches with an inlined if on the path.
  • serveTask's copy of the request, about 378. The async handler reads the request after its connection has moved on, so the request is copied.

The rest is the serve loop's own dispatch netted against the explicit loop's. #1621 cut 0.8% of the async entry's Ir a request and 17% of its peak RSS at /plaintext 16,384 connections. This run confirms the RSS figure (32.4 → 26.9 MiB). The Ir change is below this container's throughput noise, and none of the gap's frames moved by a share that the req/s cells could show.

What is left. By cell, after #1621:

  • /plaintext is 24% to 29% below the explicit entry at 256 to 4,096 connections, in the runs that count.
  • /json is outside at 16 (−14.8% on 13.3%) and 256 (−28.0% on 14.8%).
  • /json at 32 and 512 cannot be judged in this container on this day.

By frame, the second task (about 425), the router (about 455 and 348) and the request copy (about 378) are the parts of the hand-off redesign WP49 §6 still has open.

/plaintext, req/s, median (min) of 3 rounds of 10 s, before the resume build

contestant 256 1024 4096 16384 peak RSS, MiB
entry 1892376 (1815071) 1625357 (1349992) 1190962 (1048557) 1043064 (830966) 21.4
entry-copy 1673802 (1586816) 1280837 (1264848) 1273908 (1043709) 1142481 (1118375) 21.4
async 1332575 (1328724) 1074577 (1014891) 840709 (803992) 417507 (315781)* 32.4

noise band (|entry - entry-copy| / entry, medians): 256: 11.6% 1024: 21.2% 4096: 7.0% 16384: 9.5% async vs entry (median delta, inside or outside the band; * had failures, never inside): 256: -29.6% outside 1024: -33.9% outside 4096: -29.4% outside 16384: -60.0% outside*

  • /plaintext c=16384: socket read errors in async rounds 1 to 3 (59, 4090, 250)

The re-run, before:

contestant 256 1024 4096 16384 peak RSS, MiB
entry 1866423 (1326190) 1445005 (1198838) 1210064 (1133824) 1359232 (1070484) 21.4
entry-copy 1694020 (1395409) 1237292 (1200880) 1110526 (1065017) 1194952 (1093971) 21.4
async 1422154 (1258452) 1213698 (1120191) 840330 (719175) 470519 (368313)* 32.5

noise band (|entry - entry-copy| / entry, medians): 256: 9.2% 1024: 14.4% 4096: 8.2% 16384: 12.1% async vs entry (median delta, inside or outside the band; * had failures, never inside): 256: -23.8% outside 1024: -16.0% outside 4096: -30.6% outside 16384: -65.4% outside*

  • /plaintext c=16384: socket read errors in async rounds 1 to 3 (4298, 4637, 59)

/plaintext, req/s, median (min) of 3 rounds of 10 s, after the resume build

contestant 256 1024 4096 16384 peak RSS, MiB
entry 1597130 (1503843) 1235803 (1059673) 1132333 (1059823) 1308350 (1170831) 21.4
entry-copy 1784877 (1644367) 1449359 (1033573) 1134371 (1001301) 1180796 (1127803)* 21.4
async 1316876 (1223820) 1193408 (1076200) 829515 (803969) 475448 (338382)* 26.9

noise band (|entry - entry-copy| / entry, medians): 256: 11.8% 1024: 17.3% 4096: 0.2% 16384: 9.7% async vs entry (median delta, inside or outside the band; * had failures, never inside): 256: -17.5% outside 1024: -3.4% inside 4096: -26.7% outside 16384: -63.7% outside*

  • /plaintext c=16384: socket read errors in async round 1 (4244) and entry-copy round 1 (250)

The re-run, after:

contestant 256 1024 4096 16384 peak RSS, MiB
entry 1732507 (1534037) 1557238 (1274354) 1217249 (1191623) 1104856 (942448) 21.4
entry-copy 1819667 (1575519) 1216947 (1041614) 1149960 (1084513) 1350378 (1061352)* 21.4
async 1313147 (1255794) 1110340 (1082712) 963198 (743133) 322746 (316853)* 27.0

noise band (|entry - entry-copy| / entry, medians): 256: 5.0% 1024: 21.9% 4096: 5.5% 16384: 22.2% async vs entry (median delta, inside or outside the band; * had failures, never inside): 256: -24.2% outside 1024: -28.7% outside 4096: -20.9% outside 16384: -70.8% outside*

  • /plaintext c=16384: socket read errors in async rounds 1 to 3 (4224, 1226, 1) and entry-copy round 3 (661)

/json, req/s, median (min) of 3 rounds of 10 s, before the resume build

contestant 16 32 64 128 256 512 peak RSS, MiB
entry 106464 (102098) 155772 (143126) 187764 (181927) 193984 (150622) 183094 (169090) 153356 (106678) 2.7
entry-copy 109913 (108490) 163342 (125886) 167897 (151096) 203865 (188732) 176481 (159704) 179668 (177492) 2.7
async 110797 (97421) 130810 (124218) 157869 (153881) 194395 (146693) 179668 (155544) 188319 (170378) 7.2

noise band (|entry - entry-copy| / entry, medians): 16: 3.2% 32: 4.9% 64: 10.6% 128: 5.1% 256: 3.6% 512: 17.2% async vs entry (median delta, inside or outside the band; * had failures, never inside): 16: +4.1% inside 32: -16.0% outside 64: -15.9% outside 128: +0.2% inside 256: -1.9% inside 512: +22.8% inside

The re-run, before:

contestant 16 32 64 128 256 512 peak RSS, MiB
entry 115943 (112850) 144621 (127354) 176865 (135430) 164654 (158303) 178113 (173358) 177533 (167921) 2.7
entry-copy 120522 (117980) 142927 (139009) 180984 (135409) 167572 (165089) 237362 (190892) 179949 (148685) 2.7
async 105486 (94696) 139011 (130677) 187396 (149253) 145094 (141152) 174262 (156609) 167071 (163438) 7.2

noise band (|entry - entry-copy| / entry, medians): 16: 3.9% 32: 1.2% 64: 2.3% 128: 1.8% 256: 33.3% 512: 1.4% async vs entry (median delta, inside or outside the band; * had failures, never inside): 16: -9.0% outside 32: -3.9% outside 64: +6.0% inside 128: -11.9% outside 256: -2.2% inside 512: -5.9% outside

/json, req/s, median (min) of 3 rounds of 10 s, after the resume build

contestant 16 32 64 128 256 512 peak RSS, MiB
entry 134682 (131842) 161428 (126214) 188654 (128291) 218890 (186198) 200008 (194185) 205690 (161738) 2.7
entry-copy 116779 (104804) 144547 (134353) 159483 (148297) 169131 (152735) 200173 (174356) 176171 (166176) 2.7
async 114806 (110334) 151932 (150481) 176442 (169981) 222286 (146197) 213898 (182317) 158514 (147754) 7.0

noise band (|entry - entry-copy| / entry, medians): 16: 13.3% 32: 10.5% 64: 15.5% 128: 22.7% 256: 0.1% 512: 14.4% async vs entry (median delta, inside or outside the band; * had failures, never inside): 16: -14.8% outside 32: -5.9% inside 64: -6.5% inside 128: +1.6% inside 256: +6.9% inside 512: -22.9% outside

The re-run, after:

contestant 16 32 64 128 256 512 peak RSS, MiB
entry 114989 (114426) 142287 (116120) 138549 (134904) 163026 (158889) 224761 (137418) 187067 (175226) 2.7
entry-copy 113502 (97428) 132021 (126552) 154343 (137118) 178925 (156054) 258027 (243859) 155591 (140929) 2.7
async 106737 (106433) 126082 (122914) 137705 (127491) 155602 (150361) 161839 (155680) 182633 (166873) 7.0

noise band (|entry - entry-copy| / entry, medians): 16: 1.3% 32: 7.2% 64: 11.4% 128: 9.8% 256: 14.8% 512: 16.8% async vs entry (median delta, inside or outside the band; * had failures, never inside): 16: -7.2% outside 32: -11.4% outside 64: -0.6% inside 128: -4.6% inside 256: -28.0% outside 512: -2.4% inside

/db, req/s, median (min) of 3 rounds of 10 s, before and after the resume build

before:

contestant 16 64 256 peak RSS, MiB
db-entry 28880 (22978) 95718 (35429) 127449 (115884) 65.9
db-entry-copy 33438 (26668) 98032 (48016) 108585 (103642) 66.0
async-db 62327 (60330) 103830 (100548) 125205 (103416) 36.4

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 15.8% 64: 2.4% 256: 14.8% async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: +115.8% inside 64: +8.5% inside 256: -1.8% inside

before, re-run:

contestant 16 64 256 peak RSS, MiB
db-entry 40304 (26388) 114000 (113219) 112987 (109852) 65.9
db-entry-copy 35795 (28811) 129496 (128288) 131736 (117839) 66.0
async-db 73002 (68219) 129816 (113580) 112203 (110542) 40.5

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 11.2% 64: 13.6% 256: 16.6% async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: +81.1% inside 64: +13.9% inside 256: -0.7% inside

after:

contestant 16 64 256 peak RSS, MiB
db-entry 31002 (26937) 101333 (99020) 127730 (109800) 66.0
db-entry-copy 30533 (27958) 127515 (100926) 118793 (110452) 66.0
async-db 82830 (78791) 150697 (113751) 123345 (117062) 36.3

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 1.5% 64: 25.8% 256: 7.0% async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: +167.2% inside 64: +48.7% inside 256: -3.4% inside

after, re-run:

contestant 16 64 256 peak RSS, MiB
db-entry 32032 (30435) 103704 (102246) 104037 (98531) 66.0
db-entry-copy 35781 (32746) 114859 (113576) 129195 (112802) 66.0
async-db 78599 (72063) 113665 (102256) 111463 (100814) 36.3

noise band (|db-entry - db-entry-copy| / db-entry, medians): 16: 11.7% 64: 10.8% 256: 24.2% async-db vs db-entry (median delta, inside or outside the band; * had failures, never inside): 16: +145.4% inside 64: +9.6% inside 256: +7.1% inside

The other database tests, before and after the resume build

These are recorded, not judged. Each cell is the async-db median against db-entry's, with the band in brackets, from the first run of 3 rounds of 10 s, before → after. The re-runs read the same signs on every cell but /queries and /updates at 16 before (−1.0% → +10.0%, −4.1% → +6.8%) and /cached-queries at 16 after (−1.9% → +5.7%).

test 16 64 256
/queries?queries=20 −1.0% (10.4%) → +14.9% (0.7%) +9.5% (5.5%) → +14.9% (3.4%) −22.9% (4.0%) → −15.3% (3.3%)
/updates?queries=20 −4.1% (4.0%) → +3.7% (7.9%) +22.5% (3.3%) → +4.4% (1.9%) +15.9% (0.0%) → +13.7% (0.5%)
/fortunes −23.4% (0.5%) → −39.3% (13.4%) −14.9% (3.9%) → −13.9% (6.5%) −42.2% (4.6%) → −35.2% (14.7%)
/cached-queries?count=100 +11.7% (14.0%) → −1.9% (1.2%) +8.1% (9.9%) → +16.0% (0.9%) +16.3% (6.6%) → +26.3% (0.4%)

The async-db medians, before → after (first runs):

  • /db: 62,327, 103,829, 125,205 → 82,829, 150,696, 123,345
  • /queries: 27,621, 34,628, 33,269 → 33,746, 37,419, 36,915
  • /updates: 8,108, 9,881, 11,071 → 8,813, 9,483, 10,673
  • /fortunes: 47,332, 65,818, 41,478 → 45,008, 68,293, 45,263
  • /cached-queries: 80,787, 97,419, 88,523 → 77,651, 93,910, 102,065

The async-db's peak RSS is 36.4 MiB before and 36.3 after on /db, against db-entry's 66.0.

HTTP/1 codec baseline

The explicit TechEmpower entry (bench/techempower/: main.ts and server.ts on Http1Server), measured before the codec and head stages of #1416 change anything. It records where a request's instructions go, the throughput against uws and go-fasthttp, and a request shaped like a browser's, so each later stage is read against these figures. It measures; it fixes nothing.

Date 2026-11-11
Sources main at 1e18a10c. The branch commit the figures ran at, 4099299e, adds only the varied case to bench/http1-request: std/, src/ and runtime/ are main's
nish nish 0.38.0, build/nish from npm run build
CPU Intel(R) Xeon(R) Processor @ 2.30GHz, 4 logical cores, 15 GiB (a cloud VM, no hardware performance counters)
OS linux 6.18.44-fc-v378 (x64); ulimit -n 20000, net.core.somaxconn 4096
Pinning server on CPU 0, wrk on CPUs 1–3: client-shared, as in TechEmpower json and plaintext
Twins uws (uWebSockets.js v20.71.0 on Node 26.12.0) and go-fasthttp (go1.27.2), built by bash bench/http-twins/build.sh uws go-fasthttp; the other twins were not built and are left out

Each figure comes from one tool:

figure tool
Ir per request, frames by self Ir callgrind (valgrind 3.22.0), through profile.sh
frames by self samples perf record -e cpu-clock:u (perf 6.8.12, Ubuntu's linux-tools-generic, installed after apt-get update)
system calls per request strace -c -f
req/s, band wrk 4.1.0 (Ubuntu's wrk package), through run.sh, and its --browser-head for the browser-shaped table
peak RSS the server's VmHWM in /proc/<pid>/status
instructions per request in bench/http1-request cachegrind --cache-sim=no (run.mjs --instructions)

Where a request's instructions go

bash bench/techempower/profile.sh --only plaintext and --only json: /plaintext at 256 connections, 16 pipelined, and /json at 64, with profile.sh's TFB-shaped request head (Host, an 86-byte Accept and Connection). The method is the async profile's.

test Ir per request system calls per request CPU µs per request req/s under perf
/plaintext (256, 16 pipelined) 5,422 0.129 0.69 1,431k
/json (64) 6,608 2.025 6.70 149k

/plaintext repeats #1410's 5,419 Ir per request to 0.06%. The top 20 frames by self Ir, grouped. http1HeadAppend copies the request's head into the parser's buffer (std/net/http1-codec.ts), so it is parse, not head write as the plan grouped it.

group frames /plaintext Ir/req share /json Ir/req share
parse http1Next, http1TakeLine, http1HeadAppend 3,105 57.3% 3,182 48.2%
head write http1WriteResponseHead, http1PutBytes, http1PutStatusLine, http1PutCrlf, http1PutDecimal, http1PutText, http1PutFixed, http1ServerReason, http1DecimalDigits 1,356 25.0% 1,210 18.3%
loop and I/O TfbServer.resume, nish_main, Http1Connection.bodyRoom, .acquire, .feed, .inputRoom, Http1Server.send, .settle, nish_arena_release 792 14.6% 1,474 22.3%
JSON body jsonWriterPutString — 434 6.6%
other __memcpy_avx_unaligned_erms 153 2.8% 161 2.4%
below the top 20 16 0.3% 147 2.2%

On /json http1PutFixed, http1ServerReason and http1DecimalDigits fall below the top 20, so its head-write row holds the other six frames and those three are in the last row.

On /json nish_main (586) holds the inlined handler and the rest of the JSON body, so the loop row is high there. The frames, /plaintext:

    2182.0  nish.http1Next                    parse
     901.1  nish.http1WriteResponseHead       head write
     670.2  nish.http1TakeLine                parse
     332.1  TfbServer.resume                  loop
     323.5  nish_main                         loop
     252.9  nish.http1HeadAppend              parse
     153.1  __memcpy_avx_unaligned_erms       other
     145.5  nish.http1PutBytes                head write
      77.3  nish.http1PutStatusLine           head write
      76.3  nish.http1PutCrlf                 head write
      54.2  nish.http1PutDecimal              head write
      50.2  nish.Http1Connection.bodyRoom     loop
      41.1  nish.http1PutText                 head write
      40.1  nish.http1PutFixed                head write
      36.3  nish_arena_release                loop
      34.8  nish.Http1Connection.acquire      loop
      13.0  nish.http1ServerReason            head write
       8.5  nish.Http1Server.send             loop
       7.0  nish.http1DecimalDigits           head write
       6.8  nish.Http1Connection.feed         loop

perf, /plaintext, share of user-space samples: http1Next 39.3%, http1WriteResponseHead 14.5%, http1TakeLine 10.1%, nish_main 7.9%, TfbServer.resume 6.1%, libc's memmove 4.4%, http1HeadAppend 2.5%, http1PutBytes 2.1%. On /json the samples spread into the kernel's edges: http1Next 21.7%, nish_main 11.3%, __vdso_clock_gettime 10.2%, http1WriteResponseHead 7.3%, __send 6.4%, http1TakeLine 5.8%, __libc_recv 4.7%.

Throughput against the twins

bash bench/techempower/run.sh --only plaintext and --only json, in the foreground: 3 interleaved, rotated rounds of 10 s. async is async-main.ts, for reference. RSS is the highest VmHWM of any round.

/plaintext, 16 pipelined, req/s, median (min):

contestant 256 1024 4096 16384 peak RSS, MiB
entry 1,476,151 (1,475,436) 1,293,031 (923,606) 984,476 (977,314) 1,126,038 (1,045,334) 91.2
entry-copy 1,423,090 (1,186,981) 1,082,668 (1,030,347) 979,756 (934,204) 1,230,008 (1,060,673) 91.2
async 1,111,278 (1,094,883) 1,033,061 (1,006,149) 757,356 (728,859) 445,161 (365,170)* 95.8
uws 724,620 (700,639) 691,228 (647,412) 648,733 (643,709) 688,184 (640,315)* 65.4
go-fasthttp 798,743 (785,254) 711,971 (705,509) 650,169 (634,510) 608,451 (581,211) 369.3
band (entry against entry-copy) 3.6% 16.3% 0.5% 9.2%

/json, one request at a time, req/s, median (min):

contestant 16 32 64 128 256 512 peak RSS, MiB
entry 120,712 (116,946) 147,387 (144,013) 165,061 (156,733) 193,174 (190,365) 208,919 (205,984) 199,400 (193,117) 3.1
entry-copy 121,550 (117,939) 141,308 (141,176) 172,207 (170,335) 195,023 (184,087) 219,278 (199,600) 198,411 (122,304) 3.1
async 117,083 (113,248) 142,578 (142,433) 160,549 (159,292) 179,248 (174,356) 179,346 (174,368) 177,977 (168,013) 7.6
uws 106,014 (105,783) 126,524 (124,944) 141,878 (141,408) 159,263 (158,618) 175,123 (130,089) 169,712 (167,088) 57.7
go-fasthttp 91,289 (91,169) 101,389 (94,911) 107,326 (106,273) 107,418 (106,720) 100,777 (99,775) 98,230 (98,178) 25.4
band (entry against entry-copy) 0.7% 4.1% 4.3% 1.0% 5.0% 0.5%

A * cell had socket errors: async read errors in all three rounds at 16384 (4,270, 1,336 and 4,221), and uws 515 timeouts in one. The twins' /json answer is 8 bytes longer than the entry's and carries a counter.

  • On this VM the entry leads both twins everywhere, unlike the 2026-10-21 record above (324k for the entry against 412k for uws at 256). On /plaintext at 256 it is 2.0× uws and 1.8× go-fasthttp. The figures are client-shared: wrk on three cores is the ceiling the entry reaches, so the twins' rows are their own and the entry's is partly wrk's.
  • The 1024 band is 16.3%: the two copies' medians, 1,293,031 and 1,082,668, are that far apart, and entry has one round at 923,606. Both copies are still above both twins at 1024.
  • The entry's peak RSS on /plaintext is 91.2 MiB, reached across a run whose highest level is 16384 connections. It is 3.1 MiB on /json, whose highest level is 512.

A browser-shaped request

profile.sh's TFB head is an 86-byte Accept and two short fields. A browser's is several times that, and the parser's cost grows with it. A non-pipelined wrk run at 256 connections sends this 759-byte /plaintext head (756 on /json) through wrk -H: Host, Connection, a 101-byte Chrome User-Agent, a 135-byte Accept, Accept-Language, Accept-Encoding: gzip, deflate, br, zstd, a 192-byte Cookie (a session id, a CSRF token, two analytics cookies, theme and lang), Referer, Upgrade-Insecure-Requests and three Sec-Fetch-* fields. It ran 3 rotated rounds of 10 s, each server started afresh and warmed for 1 s, with the same pinning as run.sh; bash bench/techempower/run.sh --browser-head --only plaintext (and --only json) repeats it with these headers, contestants and connections.

contestant /plaintext req/s, median (min) /json req/s, median (min) peak RSS, MiB
entry 187,080 (160,222) 183,238 (169,737) 2.9
entry-copy 179,077 (164,422) 196,529 (182,344) 2.9
uws 175,311 (168,073) 167,847 (144,441) 57.5
go-fasthttp 102,033 (100,461) 90,923 (90,678) 18.6
band 4.3% 7.3%

No round had a non-2xx answer or a socket error. Without pipelining each request costs a recv and a send, so the entry leads uws by 6.7% on /plaintext and 9.2% on /json, just past bands of 4.3% and 7.3%. The parser's cost shows in instructions, below, more than here.

The codec benches, with no socket:

bench case instructions a request ns, median (band)
bench/http1-request short, a 37-byte GET 3,896 222.1 (±4.3%)
browser, a 756-byte GET with a 251-byte bearer token 10,529 548.9 (±6.6%)
api, a POST with a 61-byte JSON body 8,650 545.0 (±0.7%)
pipelined, api and browser in one read 9,346 1,064.0 for both (±0.7%)
split, browser in two reads 10,872 603.5 (±3.2%)
json1k 21,488 1,153.4 (±0.7%)
varied, three answers that never repeat a head 4,201 678.3 for three (±0.1%)

bench/http1-parse, the parser alone (24 rounds, baseline x86-64, u8x16 on SSE2), ns a head, median. new is main's parser and the figure this baseline records; old is an earlier one freeze.mjs froze, with old-copy its noise band:

head old old-copy (band) new new against old
loadgen GET, 337 bytes 250.0 260.1 (±4.0%) 199.4 −20.2%
loadgen POST, 447 bytes 339.1 359.6 (±6.0%) 272.4 −19.7%
browser GET, 1,028 bytes 739.6 757.8 (±2.5%) 552.5 −25.3%

These counts ran at 4099299e; the 3,872 for short in bench/http1-request/README.md ran at 4dc09dcc, an earlier std/net. A browser head costs 2.7 times short in bench/http1-request (10,529 against 3,896): 6,633 more instructions for 719 more bytes, about 9.2 a byte.

varied costs 305 instructions a request more than short (4,201 against 3,896). Its three heads differ, so a head kept from the request before cannot serve any of them. A head stage that reuses the response head must leave varied within its band of this figure: there the check is pure overhead.

Targets, ranked

For the codec stage, the parser's and the writer's byte loops in std/net/http1-codec.ts, by /plaintext Ir per request:

  1. http1Next: 2,182 (40.2%; 39.3% of perf's samples). The request line and the field loop.
  2. http1TakeLine: 670 (12.4%). The scan for a line's end.
  3. The writer's byte loops: http1PutBytes 146, http1PutCrlf 76, http1PutDecimal 54, http1PutText 41, http1PutFixed 40 and http1DecimalDigits 7. 364 together (6.7%).
  4. http1HeadAppend: 253 (4.7%). The copy of the request head into the parser's buffer.

For the head stage, reusing the response head within a Date tick in std/net/http1-server.ts:

  1. http1WriteResponseHead and everything under it: 1,356 Ir per /plaintext request (25.0%) and 1,210 per /json (18.3%). Within a Date tick the entry's head is the same bytes every time, so a reused head costs one copy of those bytes instead.
  2. Of that, http1WriteResponseHead's own 901, outside the put helpers.
  3. http1PutStatusLine 77 and http1ServerReason 13, which a reused head skips with the rest.

The miss case is bench/http1-request's varied, at 4,201 instructions a request.

Commands

apt-get update && apt-get install -y wrk linux-tools-generic valgrind strace
npm run build
bash bench/http-twins/build.sh uws go-fasthttp    # Node 26.12.0 and go1.27.2 (bench/http-twins/README.md)
bash bench/techempower/profile.sh --only plaintext
bash bench/techempower/profile.sh --only json     # build/tfb/profile/summary.md
bash bench/techempower/run.sh --only plaintext
bash bench/techempower/run.sh --only json         # build/tfb/results.md
bash bench/techempower/run.sh --browser-head --only plaintext
bash bench/techempower/run.sh --browser-head --only json
node bench/http1-request/run.mjs --rounds 11
node bench/http1-request/run.mjs --instructions
node bench/http1-parse/run.mjs

HTTP/1 codec re-measured after the codec, head and codegen stages

The explicit TechEmpower entry again, after the codec, head and codegen stages of #1416 landed, against the baseline above. The baseline's throughput ran on another VM (2.30GHz, kernel fc-v378), so it is not compared here. Instead the baseline's tree ran again on this VM, between two runs of main.

Date 2026-11-13
Sources after: main at e66cf339. Before: b49794d8, the baseline's main with its own src/, std/ and runtime/, built by its own compiler. 4099299e, the commit the baseline ran at, is a branch commit no longer fetchable; it differs from b49794d8 only in bench/http1-request's varied case
nish build/nish from npm run build on each tree (b49794d8 bootstrapped from the 0.34.1 seed)
CPU Intel(R) Xeon(R) Processor @ 2.10GHz, 4 logical cores, 15 GiB (a cloud VM, no hardware performance counters)
OS linux 6.18.44-fc-v445 (x64); ulimit -n 20000
Pinning client-shared: every server is 1 process with 1 worker, pinned to CPU 0 by taskset -c 0 (the entries start one worker per allowed CPU); wrk -t 3 on CPUs 1–3. Both builds and both twins ran the same way
Twins uws (uWebSockets.js v20.71.0 on Node 26.12.0) and go-fasthttp (go1.27.2), each 1 process on CPU 0
Tools as in the baseline: callgrind 3.22.0, perf 6.8.12, strace -c -f, wrk 4.1.0, VmHWM for RSS, cachegrind for bench/http1-request --instructions

run.sh interleaves its contestants within a run but cannot interleave two builds. The runs went in this order on one VM, each in the foreground: main run 1 (/plaintext, /json, browser head), then b49794d8 (the same three, then its two profiles), then main run 2 (the same three). The twins are identical in all three runs, so their rows show how far the machine drifted between runs. A change in the entry counts only where it is outside the band and larger than the twins' drift.

Verdicts

Which band governs. Each cell is held against two bands, the base run's and its own run's, and is read the cautious way both times: it counts as worse when it is below either band, and as a gain only when it is above both and larger than the twins' drift between the same runs. Taking the wider band for a loss would widen it.

# criterion verdict cells
1 profile.sh /plaintext Ir per request against the 3,251 target NOT MET 3,883, down 28.4% from 5,422 but 632 over; http1Next is 2,331 of them
2 run.sh explicit /plaintext at 256 and 1024 against go-fasthttp MET +97.6% and +124.1% at 256, +104.4% and +149.0% at 1024, outside every band; over uws +114.0% to +151.2%
3 explicit /json and the async entry no worse than the baseline beyond the band NOT MET for explicit /json, which is worse; MET for async explicit /json is worse in four cells: main 2 at 128 (−3.3%, its band 0.1%), main 2 at 256 (−9.9%, base band 8.4%), main 1 at 512 (−7.4%, its band 3.5%) and main 2 at 512 (−18.7%, outside every band). No async /plaintext or /json cell is worse
8 the real-world benches against the baseline MET for browser, api, short, pipelined, split and http1-parse; NOT MET for varied, which is worse varied +1.1% in time against main's ±0.9% band (instructions −0.8%)
9 run.sh --browser-head at 256 against the baseline MET for /plaintext; NOT MET for /json, which is worse /plaintext +13.0% in both runs; /json −5.9% and −11.7%, below the base band of 3.6% and both main bands

Where a request's instructions go

bash bench/techempower/profile.sh --only plaintext and --only json on each tree. Ir per request is deterministic; the other columns are timed.

test Ir/req b49794d8 Ir/req e66cf339 change system calls per request CPU µs per request req/s under perf
explicit /plaintext (256, 16 pipelined) 5,426 3,883 −28.4% 0.129 → 0.129 0.74 → 0.61 1,349k → 1,633k
explicit /json (64) 6,597 5,104 −22.6% 2.027 → 2.026 7.11 → 7.19 140k → 138k
async /plaintext 9,121 6,311 −30.8% 0.134 → 0.134 1.08 → 0.86 917k → 1,157k
async /json 11,138 7,825 −29.7% 2.107 → 2.108 7.35 → 6.78 136k → 147k

b49794d8 repeats the recorded 5,422 to 0.07%. The target was 3,251 (40% off 5,422): main is 3,883, 632 over it (19.4%), a 28.4% cut. /json is about 2 system calls a request, so its 1,493 fewer instructions do not show in CPU time.

The top /plaintext frames on main, grouped as the baseline grouped them:

group b49794d8 Ir/req e66cf339 Ir/req frames on main
parse 3,107 2,452 http1Next 2,330.9, http1TakeLine 121.1
head write 1,357 439 http1ServerKept 305.6, http1ServerSame4 127.8, http1WriteResponseHead 5.1, http1PutBytes 0.9
loop, handler and I/O 793 932 TfbServer.resume 447.7, the handler arrow 365.9, Http1Connection.bodyRoom 52.4, nish_arena_release 36.3, seven more under 9 each
memcpy 153 53

http1HeadAppend, the copy of the request head into the parser's buffer, no longer appears in the profile. The response head is kept and reused within a Date tick (http1ServerKept, http1ServerSame4), so the writer's byte loops fall from 1,357 to 439. The handler, inlined into nish_main before (323.7), is its own frame now (365.9). http1Next holds 60% of the instructions and 55.2% of perf's user-space samples, then TfbServer.resume with 10.5%.

On /json the top frames on main are http1Next 2,404, the handler arrow 566, TfbServer.resume 448, jsonWriterPutString 434 and http1ServerKept 256. At b49794d8 they included http1WriteResponseHead 817, http1TakeLine 691 and http1HeadAppend 252.

Throughput against the twins

bash bench/techempower/run.sh --only plaintext and --only json: 3 interleaved, rotated rounds of 10 s, each server warmed for 1 s. Medians. The band is |entry − entry-copy| / entry for that run.

/plaintext, 16 pipelined, req/s, median:

contestant level main 1 b49794d8 main 2 main 1 against b49794d8 main 2 against b49794d8
entry 256 1,630,562 1,374,462 1,759,284 +18.6% +28.0%
1024 1,349,801 1,015,251 1,570,526 +33.0% +54.7%
4096 1,031,709 893,582 1,039,378 +15.5% +16.3%
16384 1,071,796* 1,072,883 996,083 −0.1%* −7.2%
entry-copy 256 1,767,473 1,398,232 1,744,442
1024 1,385,614 1,048,531 1,354,527
4096 1,105,762 942,071 1,093,749
16384 1,019,251 906,482 987,632
async 256 1,196,719 987,121 1,255,235 +21.2% +27.2%
1024 1,046,013 876,087 995,418 +19.4% +13.6%
4096 690,874 669,862 717,053 +3.1% +7.0%
16384 357,445* 343,861* 364,486* +4.0%* +6.0%*
uws 256 740,543 679,307 729,227 +9.0% +7.3%
1024 630,705 626,226 625,206 +0.7% −0.2%
4096 574,580 585,379 585,519 −1.8% +0.0%
16384 659,711 641,170 621,921* +2.9% −3.0%*
go-fasthttp 256 825,193 767,252 784,946 +7.6% +2.3%
1024 660,363 641,021 630,628 +3.0% −1.6%
4096 586,353 582,726 581,547 +0.6% −0.2%
16384 571,192 542,139 550,353 +5.4% +1.5%
band 256 8.4% 1.7% 0.8%
1024 2.7% 3.3% 13.8%
4096 7.2% 5.4% 5.2%
16384 4.9% 15.5% 0.8%
peak RSS, MiB, /plaintext main 1 b49794d8 main 2
entry 113.7 91.3 113.7
async 116.2 95.8 116.2
uws 65.4 65.5 65.5
go-fasthttp 360.8 356.6 357.2

A * cell had socket errors and is never inside a band. async had read errors at 16384 in every run (about 4,200 a round; 6,276 in one round of main 2). entry had 3,394 read errors in one round of main 1 at 16384, and uws 25 timeouts in main 2.

  • At 256 and 1024 the entry gains 18.6% to 54.7%, outside every band and well past the twins' drift (at most +9.0%). At 4096 it gains about 16%, outside the bands. At 16384 nothing changed beyond the noise.
  • Against the twins at 256, the entry is 2.0× (main 1, +97.6%) and 2.2× (main 2, +124.1%) go-fasthttp, and +120.2% and +141.3% over uws. At 1024: +104.4% and +149.0% over go-fasthttp, +114.0% and +151.2% over uws. The figures are client-shared: wrk on three cores is the ceiling the entry runs into, so the entry's lead is a lower bound.
  • async is outside the band below the entry at every level in all three runs, as at the baseline: −26.6%, −22.5%, −33.0% and −66.6%* at 256 to 16384 in main 1, −28.7%, −36.6%, −31.0% and −63.4%* in main 2, and −28.2%, −13.7%, −25.0% and −67.9%* at b49794d8.
  • Against b49794d8, async gains +21.2% and +27.2% at 256, above every band. At 1024 main 1's +19.4% is above both its bands; main 2's +13.6% is above the base band of 3.3% but inside its own run's 13.8%, so only main 1 shows a gain there. At 4096 main 1's +3.1% is inside the bands and main 2's +7.0% above both. No async cell is worse.
  • The entry's peak RSS rose from 91.3 to 113.7 MiB (+22.4 MiB, +24.5%) on a run whose highest level is 16,384 connections, the same in both main runs. That is close to the response head #1457 keeps for each connection, about 1.3 KiB × 16,384 connections ≈ 21 MiB. async shares Http1Connection, and rose by 20.4 MiB.

/json, one request at a time, req/s, median:

contestant run 16 32 64 128 256 512 peak RSS, MiB
entry main 1 116,612 137,982 155,856 170,741 187,307 185,065 3.9
b49794d8 111,563 129,520 144,567 173,629 189,690 199,948 3.1
main 2 116,539 136,572 150,263 167,826 170,926 162,498 3.9
main 1 against b49794d8 +4.5% +6.5% +7.8% −1.7% −1.3% −7.4%
main 2 against b49794d8 +4.5% +5.4% +3.9% −3.3% −9.9% −18.7%
entry-copy main 1 115,764 134,096 154,263 180,110 193,375 191,499
b49794d8 110,161 126,317 146,902 152,693 173,776 180,695
main 2 114,576 132,153 145,697 167,696 193,900 169,801
async main 1 110,343 140,862 153,946 166,947 172,816 163,856 8.3
b49794d8 107,197 131,534 143,923 161,714 165,570 166,206 7.7
main 2 109,986 133,767 150,203 162,499 170,814 159,714 8.3
main 1 against b49794d8 +2.9% +7.1% +7.0% +3.2% +4.4% −1.4%
main 2 against b49794d8 +2.6% +1.7% +4.4% +0.5% +3.2% −3.9%
uws, drift against b49794d8 main 1, main 2 +0.7%, −0.6% +7.6%, +2.8% +4.0%, +1.5% −2.3%, +2.4% +10.5%, +7.9% −2.1%, −7.8% 57.7–57.9
go-fasthttp, drift main 1, main 2 +4.7%, +4.7% +4.3%, −0.5% +1.9%, −0.4% −0.9%, +0.3% +1.7%, −1.1% +4.4%, +2.0% 25.1–25.2
band main 1 0.7% 2.8% 1.0% 5.5% 3.2% 3.5%
b49794d8 1.3% 2.5% 1.6% 12.1% 8.4% 9.6%
main 2 1.7% 3.2% 3.0% 0.1% 13.4% 4.5%
  • From 16 to 64 connections the entry gains 3.9% to 7.8%, above the bands, but the twins drifted up too. Less the larger twin drift in the same run, the gain is −0.2 and −0.2 points at 16, −1.1 and +2.6 at 32, and +3.8 and +2.4 at 64 (main 1, main 2): a gain beyond drift only at 64, and at 32 in main 2.
  • From 128 to 512 the entry is worse in four cells, each below its own run's band or the base's (see "Which band governs" under Verdicts): main 2 at 128, −3.3% against its band of 0.1%; main 2 at 256, −9.9% against the base band of 8.4% (inside its own 13.4%), while uws drifted +7.9%; main 1 at 512, −7.4% against its band of 3.5% (inside the base's 9.6%); and main 2 at 512, −18.7%, below every band, while uws drifted −7.8%. main 1 at 128 and 256 (−1.7%, −1.3%) are inside both bands.
  • /json costs about 2 system calls a request, and the profile shows server CPU per request unchanged (7.11 → 7.19 µs) though Ir fell 22.6%. A non-pipelined request is bound by recv and send, not by the codec.
  • Peak RSS: 3.1 → 3.9 MiB for the entry, 7.7 → 8.3 for async.

A browser-shaped request

bash bench/techempower/run.sh --browser-head: the baseline's 759-byte /plaintext head (756 on /json), non-pipelined, 256 connections, 3 rotated rounds of 10 s.

contestant /plaintext main 1 b49794d8 main 2 /json main 1 b49794d8 main 2
entry 171,057 151,352 170,972 169,371 180,050 159,050
entry-copy 167,810 163,921 173,911 170,364 173,556 154,262
uws 156,937 150,538 152,613 130,114 154,635 148,551
go-fasthttp 104,752 101,825 99,398 93,559 89,633 91,952
band 1.9% 8.3% 1.7% 0.6% 3.6% 3.0%
entry against b49794d8 +13.0% +13.0% −5.9% −11.7%

Peak RSS: entry 3.4 MiB on main against 2.9 at b49794d8, uws about 57, go-fasthttp about 19. No round had a non-2xx answer or a socket error.

  • /plaintext: +13.0% in both runs, outside every band (8.3% at the base) and past the twins' drift (uws +4.3% and +1.4%, go-fasthttp +2.9% and −2.4%).
  • /json is worse: −5.9% and −11.7%, outside the base band of 3.6% and both main bands. uws drifted −15.9% and −3.9% between the same runs, which covers main 1's drop but not main 2's. main 1's entry rounds spread from 144,435 to 190,184, so the figure is unsteady, but it is not a gain.
  • The baseline's recorded 187,080 and 183,238 ran on the 2.30GHz VM and are not comparable with these.

The codec benches

node bench/http1-request/run.mjs --instructions --base b49794d8 and --rounds 11 --base b49794d8. --base builds std/ at b49794d8 with the current compiler, so the columns differ only in the library. --rounds 11 is a floor: the harness ran 16 rounds so every column takes every slot.

case Ir/req main Ir/req base change ns main (band) ns base (band) change
browser 8,892 10,279 −13.5% 517.3 (±1.9%) 626.8 (±0.9%) −17.5%
api 7,371 8,491 −13.2% 561.6 (±0.0%) 650.5 (±7.3%) −13.7%
short 3,094 3,815 −18.9% 197.8 (±4.1%) 252.6 (±1.4%) −21.7%
pipelined 7,862 9,138 −14.0% 1,037.9 (±3.0%) 1,259.7 (±4.6%) −17.6%
split 9,257 10,626 −12.9% 559.5 (±3.9%) 649.7 (±0.1%) −13.9%
json1k 21,385 21,407 −0.1% 1,330.0 (±5.3%) 1,389.3 (±0.7%) −4.3%
json4k 73,460 73,446 +0.0% 4,277.8 (±5.0%) 4,345.8 (±1.0%) −1.6%
json16k 290,411 290,247 +0.1% 16,101.4 (±5.0%) 17,408.8 (±1.2%) −7.5%
json40k 724,665 724,201 +0.1% 41,087.0 (±2.5%) 43,325.4 (±0.2%) −5.2%
varied 4,059 4,092 −0.8% 777.7 (±0.9%) 769.0 (±1.9%) +1.1%
  • browser and api are cheaper by 13% in instructions and 14% to 18% in time, outside both bands.
  • varied is 1.1% slower in time: outside main's ±0.9% band, inside the base's ±1.9%, so by the rule under Verdicts it is worse and criterion 8 is NOT MET for it. Its instructions fell 0.8%. It is the case where every head misses the reuse.
  • json4k to json40k cost 0.0% to 0.1% more instructions, which is noise in a body-bound case; their times fell.

bench/http1-parse, the parser alone (24 rounds, baseline x86-64, u8x16 on SSE2), ns a head, median:

head old old-copy (band) new new against old at the baseline
loadgen GET, 337 bytes 297.1 298.4 (±0.4%) 225.7 −24.0% −20.2%
loadgen POST, 447 bytes 406.3 426.9 (±5.1%) 292.5 −28.0% −19.7%
browser GET, 1,028 bytes 897.5 883.2 (±1.6%) 642.5 −28.4% −25.3%

node bench/http1-parse/run.mjs refuses to run on main: since #1460 the parser keeps each field line's CRLF, so new's checksum (5937a130) no longer equals the known value frozen in run.mjs (b29eddcc). These figures come from a scratch copy of run.mjs, not in the tree, that skips that one check for new only and still checks that every round of a column agrees. old and old-copy passed the frozen check. The harness is left as it is here: bench/http1-parse/run.mjs needs its pinned new checksum updated, as a follow-up outside this stage.

Commands

apt-get update && apt-get install -y wrk linux-tools-generic valgrind strace
npm run build
bash bench/http-twins/build.sh uws go-fasthttp
ulimit -n 20000
# main 1, at e66cf339
bash bench/techempower/run.sh --only plaintext
bash bench/techempower/run.sh --only json
bash bench/techempower/run.sh --browser-head
bash bench/techempower/profile.sh --only plaintext
bash bench/techempower/profile.sh --only json
node bench/http1-request/run.mjs --instructions --base b49794d8
node bench/http1-request/run.mjs --rounds 11 --base b49794d8
# bench/http1-parse: a scratch copy of run.mjs with the known-checksum check skipped for `new` only; not in the tree
# b49794d8, in a worktree with the seed in build/seed
git worktree add ../nish-base b49794d8
NISH_BOOTSTRAP=build/seed/bin/nish bash scripts/bootstrap.sh --quiet
bash bench/techempower/run.sh --only plaintext
bash bench/techempower/run.sh --only json
bash bench/techempower/run.sh --browser-head
bash bench/techempower/profile.sh --only plaintext
bash bench/techempower/profile.sh --only json
# main 2, at e66cf339
bash bench/techempower/run.sh --only plaintext
bash bench/techempower/run.sh --only json
bash bench/techempower/run.sh --browser-head

Syscall cost

Not measured by bench/run.mjs, which carries this section over unchanged. bash bench/syscall-cost/run.sh times a syscall's entry and exit (syscall(SYS_getppid)) against the TCP work of a loopback request/response, pinned to one CPU; bench/README.md describes it and splits a keep-alive request's system time. 2026-10-30, ce8f92ce, Intel Xeon @ 2.10 GHz, KVM VM, Linux 6.18.44 (eIBRS, no KPTI), 7 interleaved rounds of 10^6 calls: entry and exit 106.0 ns (101.9–113.2), recv with nothing queued 173.7 ns, setsockopt(TCP_QUICKACK, 0) 179.7 ns, getsockopt(TCP_INFO) 283.0 ns, and 653 to 673 ns of TCP work per send or recv in a round.

For bench/http1-server.ts at 2.07 syscalls a request that is 0.22 µs of about 5 µs of system time, about 4%: under the 0.5 µs line, so io_uring is not worth building on this evidence. The reported workload ran on a Xeon Platinum 8260 VM on Linux 6.8, which this run did not measure.

TLS handshake

Not measured by bench/run.mjs, which carries this section over unchanged. node bench/tls-handshake.mjs times the server CPU of one TLS 1.3 handshake, tests/link/net_interop_server signing with its P-256 certificate, against a byte-identical copy of the server for the noise band and, with --baseline REV, against another rev's server. bench/README.md describes it, and WP34 K5 records its figures for the scalar inversion's baseline and its result.

HTTP/2 and HTTP/3

Not measured by bench/run.mjs, which carries this section over unchanged. node bench/h2load.mjs drives tests/link/net_interop_server (main serve, pinned to CPU 0, 64 slots) with h2load on the other CPUs for HTTPS/1.1 and HTTP/2 over TLS, and with the server's own scripted QUIC client for HTTP/3, one build against another in interleaved rounds (a b, then b a). Run with one --bin it measures the build against itself, so the spread of the b / a ratios is the noise band.

build/seed/bin/nish tests/link/net_interop_server/main.ts -o build/interop.ir/ --link build/interop
node bench/h2load.mjs --bin build/interop --rounds 5

Measured 2026-11-12 with the interop server built from commit 747126db (the main the branch started from, no source change) by the 0.38.0 seed, build/seed/bin/nish ... --link build/interop, profile speed (-O3 with LTO). Machine: a KVM guest, Intel Xeon @ 2.10 GHz, 4 vCPUs (one thread per core), 15 GB, Linux 6.18.44, h2load nghttp2 1.59.0 (Ubuntu 24.04), loopback. 5 rounds, 64 slots, 20,000 requests per round for the two h2load rows (16 clients; 8 streams each for HTTP/2, none for HTTPS/1.1) and 2,000 requests over one connection for HTTP/3.

scenario a req/s b req/s b / a (min–max)
HTTPS/1.1 h2load --h1 c=16 88,771 85,270 0.911 (0.787–1.187)
HTTP/2 over TLS, h2load c=16 m=8 177,277 171,397 0.967 (0.704–1.173)
HTTP/3, main h3-load c=1, 2,000 requests, in process 28,986 29,412 1.046 (0.920–1.566)

A second identical run a few minutes later on the same VM gave 85,703 / 102,403 (1.137, 0.956–1.232), 155,584 / 166,240 (1.051, 0.805–1.213) and 30,303 / 30,303 (1.000, 0.881–1.241): the levels repeat to about 15%, so they are this machine's, not one run's luck.

a and b are the same binary, so the ratios are the noise band: about ±20 to 30% between the extremes of five rounds, and up to +57% on HTTP/3 in the first run. A difference between two builds smaller than that is not shown by five rounds; widen --rounds first.

Against the table in bench/README.md (the same harness, 64 slots, 5 rounds: 47,354 / 74,411 / 13,245 req/s, HTTP/3 band 0.886–1.081). These figures are 1.9x, 2.4x and 2.2x higher. That table names no machine, compiler or commit, so the gap cannot be attributed here; what is shown is that it is not noise, since this VM reproduced its own levels twice. The likely causes are the host's CPU (this guest's cores are a different part and a shared host) and the build, and neither was varied. The two tables are each a ratio on one machine and are not to be read against each other; compare a build with another only within one table.

Not h2load's HTTP/3 number: Ubuntu's nghttp2-client is built without ngtcp2 and nghttp3, so the script falls back to main h3-load, the server and client.ts's QUIC client in one process on CPU 0, one connection with its requests one after another. That figure is the two sides' work together and falls as the connection's streams pile up; it compares builds and is not a server capacity, nor comparable with an h2load HTTP/3 run.

What the cloud VM allows: the median requests per second of one shared-host guest, useful against another build measured the same way on the same machine, in the same session. They are not comparable with bare metal, another VM size or another h2load.

PostgreSQL client: where the time goes

Not measured by bench/run.mjs, which carries this section over unchanged. node bench/postgres/run.mjs --rounds 12 times the module against libpq (bench/README.md describes it); this section records what a profile of the module's side found, and the changes it suggested, none of which paid. 2026-10-27, main at 3a53579, four cores, PostgreSQL and libpq 18.6.

Reading the tables. A delta is a variant's median client CPU per query minus main's; + is slower. The noise band is main against its byte-identical copy in the same interleaved rounds, and each table is read against its own band: list's measured 1.35 µs in the baseline and in the decoder table, and 2.06 µs in the buffer table, so 2.06 µs is the larger figure seen.

The baseline. run.mjs --rounds 12: 12 timed rounds after an untimed warm-up, the binaries interleaved within each round in an order that rotates by one each round. Client CPU per query, median (IQR):

Workload Nish C Nish − C Noise band
pk 12.76 µs (0.38) 15.22 µs (0.71) −2.47 µs (−16.2 %) 0.34 µs (2.7 %)
list 53.88 µs (4.57) 67.92 µs (4.95) −14.03 µs (−20.7 %) 1.35 µs (2.5 %)
insert 32.13 µs (1.73) 34.71 µs (3.36) −2.59 µs (−8.1 %) 0.67 µs (2.1 %)

All three differences are outside the band. run.mjs's own verdict also asks for a difference larger than both sides' IQRs, and that holds for pk and list but not for insert, whose −2.59 µs is inside C's 3.36 µs IQR, so the tool prints "inside the noise" for it.

The profile. perf record at 4,999 Hz over 200,000 pk, 20,000 list and 10,000 insert queries, from a speed build whose IR marks the module's decoders and the bench's fold functions noinline, so each shows its own self time. In a plain build PgText.timestamp is inlined into the bench's Fold.timestamp and the other decoders partly into Bench.run. Share of all samples, kernel included:

pk list insert
Kernel (socket, scheduler) 91.2 % 68.7 % 92.9 %
The module, per query 2.7 % 10.5 % 2.0 %
The bench's checksum fold (Fold.*, Bench.*) 3.8 % 17.9 % 1.7 %
libc and the rest 2.3 % 2.8 % 2.7 %

insert's module figure leaves out sha256Compress (1.4 %), SCRAM at connect. On list the module's functions are PgText.timestamp 2.4 %, readRow 2.2 %, PgArrayWalker.next 2.1 %, PgText.int 1.0 %, dispatch 0.9 %, PgConnection.int 0.4 %, and no other above 0.25 %. The bench's Fold.bytes, a byte-at-a-time checksum like twin.c's, is 12.5 % by itself. On pk and insert no module function is above 0.7 %. Out of line, every decoder pays a call it does not pay in the shipped build, so 10.5 % of list (about 5.7 µs) overstates the module's share.

Decoding, timed in isolation. Each decoder called 20 million times on input that changes every call, with a printed checksum, pinned to one core; median of 9 runs, per call:

main changed the change
PgText.timestamp, 2024-01-02 03:04:05.123456+00 18.8 ns 20.6 ns the 14 digits tested straight-line, an OR of c - 48 and 57 - c, in place of counting non-digits over 19 bytes
PgText.int, 7 digits 10.3 ns 9.1 ns no overflow test per digit when there are at most 18 digits
PgArrayWalker, a 4-element text[] 65.4 ns 46.9 ns an unquoted byte tested against the five refused bytes only when it is under 35, 92 or over 122

A list query decodes 20 rows of two timestamps, an int and an array, so all of its timestamp decoding is 40 × 18.8 ns, about 0.75 µs; removing it outright could not clear the 1.35 µs band. The walker change, the largest of the three, saves about 0.4 µs a query at 4 elements an array.

Decoding, timed end to end. The three changes and all three together, against main and its copy in 12 interleaved rounds (a fixed order within each round, no warm-up round):

Workload main copy (the band) timestamp int walker all three
pk 13.54 µs (0.60) −0.01 +0.04 −0.49 −0.50 −0.31
list 57.74 µs (7.37) +1.35 +2.33 +1.21 +0.59 +1.42
insert 32.84 µs (5.32) +1.29 +0.20 −0.01 −1.47 −1.14

On list, the only workload that decodes timestamps and arrays in bulk, every change measured slower than main, and none was faster by more than the band. The pk and insert cells outside their bands are noise: neither workload reads an array, yet the walker change moves both by the most. Its 18 ns a call is real, but at about 0.4 µs a list query it is about a quarter of the band, so no decoding change ships. Binary results were not tried: integer decoding (PgText.int and PgConnection.int) is about 1.4 % of list and under 0.7 % of the others, and the timestamp and text[] columns list reads would cost more to decode from binary than from text.

The input buffer. strace -c shows the module's 8 KiB first input buffer taking a list answer in two reads, 5,717 recvfrom and as many epoll_wait for 3,000 queries against libpq's 3,028. A 16 KiB first size, libpq's own, brings it to 3,028; 32 and 64 KiB to about 3,015. Timed against main in 12 interleaved rounds (a fixed order within each round, no warm-up round):

Workload main main's copy (the band) 16 KiB 64 KiB
pk 12.85 µs (0.88) +0.30 (2.3 %) +0.09 (0.7 %) +0.57 (4.4 %)
list 52.97 µs (6.52) +2.06 (3.9 %) +2.02 (3.8 %) +1.26 (2.4 %)
insert 33.10 µs (2.04) −0.74 (−2.2 %) +0.86 (2.6 %) −0.98 (−3.0 %)

Three cells fall outside their band: pk at 64 KiB (+0.57, slower), insert at 16 KiB (+0.86, slower) and insert at 64 KiB (−0.98, faster). list at 16 KiB sits at its band. All are inside main's IQR, and the signs disagree between sizes and workloads. list, whose system calls the larger buffer halves, is not faster at either size, so the default stays 8 KiB.

No system call left to remove. strace -c over 2,000 list queries counts 1,990 sendto (at depth 16, one per answer that frees a slot), and the 16 KiB buffer above brings recvfrom and epoll_wait to about one each per query; insert, at depth 1, counts 2,007 of each. Each run makes two epoll_ctl calls in all.

The module already writes a query's Bind, Execute and Sync as one run of bytes that the caller sends in one call, and every query freed in a wakeup goes in that wakeup's one sendto, so fewer writes would need the caller to wait on more queries at once, which is not the module's to choose.

Growing the buffer on demand, and everything together. A buffer that starts at 8 KiB and doubles, up to 64 KiB, after a read fills it to its end, so only a connection that receives in bulk pays for the room: strace counts 2,023 recvfrom for 2,000 list queries against main's 3,829. Timed with the decoder changes too, in two runs of 12 rounds each after a warm-up round, the order rotating by one each round:

Workload Run main copy (the band) growth growth and the three decoders the three decoders
pk 1 13.40 µs (0.88) +0.01 −0.11 −0.04
pk 2 12.65 µs (0.59) +0.12 +0.51 +0.55 +0.44
list 1 55.94 µs (3.83) −0.22 −0.64 −1.48
list 2 52.38 µs (2.98) +0.11 +0.31 +2.63 +1.80
insert 1 32.39 µs (1.97) +0.37 +0.58 −1.17
insert 2 31.26 µs (2.29) +0.35 −0.16 +0.50 +0.15

Run 1 put everything together 1.48 µs under main on list, outside that run's 0.22 µs band; run 2, the same binaries, put it 2.63 µs over. The copy's band, 0.1 to 0.4 µs in these runs, is about a tenth of how far the same binary's median moves between runs, so no single run's delta outside it is a result. Across the two runs no change is faster than main on every workload, and none is faster twice, so none ships, the growth included.

readRow was not changed: it is 2.2 % of list out of line, about 1.2 µs a query for 20 rows, and already reads each column's length without a call. Halving it would save less than the run-to-run spread above.

Unix sockets against loopback TCP

Not measured by bench/run.mjs, which carries this section over unchanged; recorded by hand. node bench/unix-ipc.mjs times an echo between two processes over loopback TCP (TCP_NODELAY), a Unix stream socketpair and a seqpacket socketpair, and node bench/postgres/run.mjs --unix the module's SELECT 1 and a 100-row read over TCP and over the server's Unix socket; bench/README.md describes both and has the full tables. 2026-10-31, the bench code as of add5bcf (the commits after it reformat it and add error handling outside the timed loops; what is measured is unchanged), Intel Xeon @ 2.80 GHz, 4 CPUs, KVM VM, Linux 6.18.44, PostgreSQL 18.6 (pgdg), 12 interleaved rounds after a warm-up.

The noise band is the same transport run twice in every round (unix-ipc's run a against run b, postgres's build against its byte-identical copy); a difference counts only outside it and both sides' IQRs.

tcp unix unix − tcp noise band verdict
echo 64 B, round trip median 51.16 µs 42.59 µs (stream) −8.56 µs (−16.7 %) 1.29 µs outside the noise
echo 64 B, round trip p99 110.93 µs 99.08 µs (stream) −11.85 µs (−10.7 %) 2.34 µs inside TCP's IQR (17.86): noise
echo 64 B, client CPU/trip 27.25 µs 21.49 µs (stream) −5.76 µs (−21.2 %) 0.76 µs outside the noise
echo 64 B, client CPU/trip 27.25 µs 22.13 µs (seqpacket) −5.12 µs (−18.8 %) 0.76 µs outside the noise
echo 64 B, peer CPU/trip 27.12 µs 20.52 µs (stream) −6.61 µs (−24.4 %) 1.22 µs outside the noise
echo 64 B, peer CPU/trip 27.12 µs 21.25 µs (seqpacket) −5.87 µs (−21.6 %) 1.22 µs outside the noise
echo 4 KB, round trip median 53.07 µs 47.78 µs (stream) −5.29 µs (−10.0 %) 0.93 µs outside the noise
echo 4 KB, client CPU/trip 35.54 µs 31.74 µs (stream) −3.80 µs (−10.7 %) 0.95 µs outside the noise
echo 4 KB, client CPU/trip 35.54 µs 30.27 µs (seqpacket) −5.27 µs (−14.8 %) 0.95 µs outside the noise
echo 4 KB, peer CPU/trip 28.15 µs 24.01 µs (stream) −4.14 µs (−14.7 %) 0.67 µs outside the noise
echo 4 KB, peer CPU/trip 28.15 µs 23.24 µs (seqpacket) −4.91 µs (−17.4 %) 0.67 µs outside the noise
SELECT 1, wall/query 66.13 µs 56.60 µs −9.53 µs (−14.4 %) 1.38 µs outside the noise
SELECT 1, client CPU/query 28.13 µs 21.95 µs −6.19 µs (−22.0 %) 0.40 µs outside the noise
SELECT 1, server CPU/query 37.39 µs 30.71 µs −6.67 µs (−17.9 %) 1.21 µs outside the noise
100 rows, wall/query 191.59 µs 173.30 µs −18.30 µs (−9.5 %) 1.85 µs outside the noise, by 2 µs over TCP's IQR (16.27)
100 rows, client CPU/query 70.59 µs 61.00 µs −9.59 µs (−13.6 %) 1.52 µs outside the noise
100 rows, server CPU/query 159.13 µs 141.08 µs −18.06 µs (−11.3 %) 0.24 µs outside the noise

The echo client's CPU per trip includes making each message and checking the reply byte by byte inside its timed loop, a cost the same on every transport that the peer, echoing only, does not pay: it is why the client's figure is above the peer's at 4 KB and its percentages the smaller; the peer's row is the transport alone.

Seqpacket is within the noise of stream in every figure (64 B median 44.61 µs, 4 KB 47.11 µs); its CPU rows, from the same rounds, are in the table beside stream's. The 4 KB p99 is inside the noise for both Unix kinds. A 3-round run on the same box put the bands 1.3 to 8 times wider (64 B median 2.18 µs, 4 KB median 7.43 µs) and found the 4 KB round trip inside the noise; the 12-round figures above are the record.

Regular expressions

Not measured by bench/run.mjs, which carries this section over unchanged. node bench/regex/measure.mjs --before <nish> --rounds 24 --size times nish/regex over a 64 KB corpus of mixed ASCII and non-ASCII lines, against a byte-identical copy of the binary for the noise band and against the same program built with another compiler's std/ (bench/README.md describes it). 2026-10-30: this branch against main at 384371b, before property escapes and non-ASCII folding, one run of 24 interleaved rounds, four cores, x86-64.

The cases without the Unicode features. Timings this short move by more than any difference between the two builds, so the verdict is the instructions a pass retires, counted with valgrind --tool=cachegrind as the difference between a run of 40 passes and one of 20 (no setup). The time ratio is main's over this branch's, so above 1 means this branch is faster.

Case Pattern Instructions a pass, main Branch / main Median, main Median, branch Time ratio (min / median) Noise band (median, main / branch)
literal needle 2,287,435 1.000x 8.3 µs 8.3 µs 0.999x / 0.997x 0.1% / 0.7%
class [0-9]+ 6,541,291 1.000x 34.3 µs 30.7 µs 1.094x / 1.119x 3.2% / 0.1%
alternation fox|dog|needle|World 9,476,271 1.000x 60.7 µs 59.9 µs 1.035x / 1.014x 3.0% / 0.5%
group (?:[a-z]+ ){2}[a-z]+ 34,539,670 1.000x 269.8 µs 257.4 µs 1.010x / 1.048x 1.9% / 4.8%
anchored ^[A-Z][a-z]+ (m) 5,661,967 0.992x 21.1 µs 20.1 µs 0.997x / 1.050x 0.3% / 3.4%
icase-ascii hello world|quick (i) 5,267,653 1.000x 25.0 µs 24.2 µs 0.976x / 1.033x 0.3% / 1.6%
icase-class [A-Za-z]+ (i) 62,588,232 1.000x 438.0 µs 432.4 µs 1.049x / 1.013x 4.0% / 4.3%
exec (\w+)@(\w+)\.(com|org) 169,456,374 0.926x 515.8 µs 530.7 µs 1.094x / 0.972x 10.3% / 11.3%

The instruction columns are counted against main at 1391cf8, whose src/ this branch's is. Six cases retire main's instructions to within 0.01%. class, alternation and icase-class were 0.5% over until the DFA's two context masks, which gained a sixth slot saying whether U+017F and U+212A are word characters, were sized by a named constant again: sized CTX_KINDS + 1, they were no longer a constant length, so they left the Regex object for the heap and dfaForward paid a pointer load per read.

anchored was 2.6% over until a context read under i stopped testing U+017F and U+212A on ASCII bytes. exec retires 7.4% fewer: all of it is in the Pike VM's addThread, whose source is main's, where the loops that copy capture slots compile to fewer instructions around the inlined assertHolds; no algorithm changed, and its time ratio is inside the band.

Compiling alone: a pass compiles the case's patterns once, 10,000 passes a run. Instructions are per compile, counted the same way between 4,000 and 2,000 passes.

Case Patterns Instructions, main Branch / main Median, main Median, branch Time ratio (min / median) Noise band (median, main / branch)
compile-class a large class with non-ASCII letters 26,785 0.990x 5.0 µs 5.2 µs 1.006x / 0.979x 0.8% / 1.0%
compile-icase-class the same class under i 27,376 5.67x 5.0 µs 17.1 µs 0.321x / 0.291x 3.9% / 9.5%
compile-nonspace-icase \S+ (i) 16,891 0.967x 3.6 µs 3.8 µs 1.016x / 0.944x 1.3% / 5.1%
compile-icase-literal é (i) 3,885 1.53x 1.9 µs 2.1 µs 0.951x / 0.893x 0.8% / 4.7%
compile-many ten small patterns 274,390 1.002x 47.2 µs 46.7 µs 0.977x / 1.011x 2.5% / 1.0%

The two folding rows are the real cost, and they are work main does not do: main folds no letter outside ASCII. A compile reads the folding table in place, so nothing is decoded ahead of time and nothing is kept between compiles. An index of every sixteenth folding code point finds a letter's place, and a flag on two-letter orbits saves the second lookup. The large class costs about 12 µs more than main. A single é costs about 0.2 µs. A pattern that folds nothing above ASCII never reads the table. \S, \D and \W under i don't either, being closed under folding already.

The three cases with the Unicode features. Main refuses \p{…} and folds no non-ASCII letter, so these time this branch alone:

Case Pattern Median Noise band (median)
property \p{L}+ 601.7 µs 0.0%
script \p{Script=Greek}+ 354.5 µs 2.0%
icase-unicode σοφία|école|straße|über (i) 358.2 µs 5.6%

Linked size of bench/regex/size.ts, which imports nish/regex and compiles [0-9]+: 92,824 bytes from main and 177,448 from this branch. The 84,624 bytes are mostly the Unicode tables, about 70 KB of packed strings, plus the code that reads them. regexCompile's parser reaches them, so they are linked whether or not a pattern names a property.

HTTP/1.1 request parser

Not measured by bench/run.mjs, which carries this section over unchanged. node bench/http1-parse/run.mjs parses one request a head with the live parser (new), main's parser frozen beside it (old) and a second frozen copy (old-copy, the noise band); bench/README.md describes it and has the commands for the Cascade Lake VM. Instructions a head are callgrind's, the difference between 12,000 and 2,000 iterations over 10,000.

Date 2026-11-03
nish this branch against main at 96a38347, --profile speed
CPU Intel(R) Xeon(R) Processor @ 2.80GHz, 4 logical cores (sse2, avx2, bmi2, avx512bw); baseline x86-64, u8x16 on SSE2
Runs 24 interleaved rounds of 3 parsers a head; median (min–max) ns a head
Command npm run build && node bench/http1-parse/run.mjs
head old old-copy (band) new new against old / old-copy instructions a head instructions a byte
loadgen GET, 337 bytes 406.9 420.3 (±3.3%) 344.9 (316.1–477.2) −15.2% / −17.9% 5,617 → 4,769 16.7 → 14.2
loadgen POST, 447 bytes 655.0 591.8 (±9.6%) 483.8 (439.3–688.6) −26.1% / −18.2% 7,761 → 6,483 17.4 → 14.5
browser GET, 1,028 bytes 1,299.7 1,373.5 (±5.7%) 1,024.4 (936.9–1,531.5) −21.2% / −25.4% 16,335 → 13,667 15.9 → 13.3

Under --cpu x86-64-v3: −18.6%, −17.1%, −24.1% (bands ±2.6%, ±0.4%, ±6.4%). The steps, in instructions a head (loadgen GET / POST / browser GET), each kept because it moved all three: the line scan jumps to the first control byte of a 16-byte block instead of finishing it a byte at a time (5,617/7,761/16,335 → 5,399/7,422/15,757); a branch-free token check against a 128-bit set (→ 5,182/7,098/14,962); a kept field name lowercased while it is scanned in head rather than in a second pass (→ 5,113/6,987/14,627); CRLF taken in one step (→ 4,776/6,492/13,685). Results are checked identical to main's parser by tests/link/net_http1_parse_diff.

Http1Connection per request, hot, cold, idle and DRAM-cold

Not measured by bench/run.mjs, which carries this section over unchanged. node bench/http1-conn/run.mjs times Http1Connection and the codec under it per request, with no socket, against main's std/ (old) and a byte-identical copy of that build (old′, the noise band); bench/http1-conn/README.md describes the six shapes, the working set against the caches, the RSS mode and misses.sh.

Date 2026-11-06
nish the hot-first Http1Parser layout against main at 98c4f9a7, --profile speed
CPU Intel(R) Xeon(R) Processor @ 2.30GHz, 4 cores (L1d 48 KiB and L2 2 MiB a core, L3 504 MiB), pinned to core 1
Runs 15 interleaved rounds, each the fastest of 5 batches; 200,000 requests a batch, 20,000 in the -dram shapes, which sweep a 1 GiB eviction ring between requests; cold, idle and direct over 10,000 connections (about 10 MiB, inside L3)
Command node bench/http1-conn/run.mjs --connections 10000 --rounds 15 --base 98c4f9a7, then bash bench/http1-conn/misses.sh
shape old old′ new
hot 323.0 (308.1–329.9) 324.4 (310.1–332.1) 1.004 320.0 (305.8–333.6) 0.990
cold 353.3 (334.5–379.9) 356.9 (339.7–382.9) 1.010 341.6 (332.1–375.0) 0.967
idle 446.5 (425.9–472.9) 439.6 (424.4–452.9) 0.984 441.7 (421.0–444.2) 0.989
direct 434.3 (415.2–442.4) 435.8 (415.7–440.2) 1.004 434.7 (414.8–439.7) 1.001
idle-dram 672.0 (650.3–735.5) 668.5 (632.8–701.6) 0.995 650.7 (620.0–677.0) 0.968
direct-dram 660.2 (643.8–715.8) 666.5 (641.2–715.5) 1.010 649.1 (626.1–666.3) 0.983
peak RSS per idle connection, bytes 1026 (1025–1026) 1026 (1025–1026) 1026 (1025–1026)

ns per request, median (min–max) and ratio of medians to old. idle shows no wall-time gain outside noise. In idle-dram the median is 3.2% under old against old′'s 0.5%, but the ranges overlap.

What the layout does measurably reduce is lines touched. Under cachegrind, an idle request misses D1 10.95 times on main and 9.01 on this layout, and LL 0 times on both, because the pool fits in LL. The count is the difference between 100,000 and 0 requests over 10,000 connections. In idle-dram, with the eviction sweep's own misses left out, it misses LL 10.94 times on main and 9.00 on this layout. The saving is in Http1Connection.feed (2.38 to 0.75 read misses) and in the write misses of unpark, http1Next and Http1Connection.next; http1Next and inputRoom take on 0.44 and 0.25 read misses. Reading straight into the lent parser.buf (direct) saves no misses.

A minimal GET on Http1Server

Not measured by bench/run.mjs, which carries this section over unchanged. This section breaks down one keep-alive GET answered with a 200 and a small JSON body: where its instructions go, its wall-clock time, the bytes a connection holds, and the server CPU and memory at 18,000 keep-alive connections. It then bounds what a lean request path could save (#1760). std/, src/ and runtime/ are main at 4d0faa4b throughout. Each table names the bench code that produced it: either main at 4d0faa4b with a path, or "this PR's bench code", the files this section's PR adds or changes under bench/.

Date 2026-11-18
nish main at 4d0faa4b, --profile speed, built --cpu x86-64
CPU Intel(R) Xeon(R) Processor @ 2.10GHz, 4 cores (L1d 48 KiB and L2 2 MiB a core, L3 260 MiB), 15.7 GiB
Runs callgrind and cachegrind with NISH_SIMD=base and glibc's string functions pinned by GLIBC_TUNABLES, 1,000 iterations less 500, over 500; wall clock in 12 interleaved rounds against a byte-identical copy (bench/http1-request), and in 15 rounds (7 for the stages) against old and old′ (bench/http1-conn); bench/handler-ring in 5 interleaved rounds
Command node bench/http1-request/breakdown.mjs; node bench/http1-request/run.mjs --instructions; node bench/http1-request/run.mjs --case get --case short --case fields0 --case fields4 --case fields10; node bench/http1-conn/run.mjs --shape hot,cold,idle-dram,direct-dram --connections 18000 --rounds 15 --base origin/main; node bench/http1-conn/run.mjs --shape hot,idle --connections 1 --rounds 15 --rss 0 --base origin/main; node bench/http1-conn/run.mjs --shape cold,idle-dram,direct-dram,stages --connections 18000 --rounds 7 --base origin/main (origin/main at 4d0faa4b in each); build/nish bench/http1-conn/bytes.ts --link build/bench/http1-conn/bytes && build/bench/http1-conn/bytes; bash bench/handler-ring/run.sh --nodb --conns 18000 --designs "ring epoll1 epoll epoll-copy" --server-cpus 0; bash bench/handler-ring/run.sh --nodb --conns 18000 --designs "h1 h1-copy epoll1" --rounds 5

The request shapes are cases of bench/http1-request (this PR's bench code, bench/http1-request/main.ts):

  • get is 350 bytes: GET /json with Host: api.example.com, User-Agent, Accept: application/json, and a 221-byte HS256 Bearer Authorization. The program reads none of the last three.
  • short is 37 bytes: GET / HTTP/1.1 and Host: example.com.
  • fields0, fields4 and fields10 are GET /json with Host: example.com and 0, 4 or 10 X-Pad-k: value-k fields. They are 41, 113 and 221 bytes, and give the cost of each unread field.

Each case is answered 200 with Content-Type: application/json and a JSON body written by the handler. Every request has the same status and fields as the one before, so the response head takes the kept-head path.

Instructions a request, by component

Every instruction is given to the source function its debug line sits in, not the function callgrind names, because the optimiser inlines most of std/net into its callers. bench/http1-request/breakdown.mjs does this over bench/http1-request/main.ts, both this PR's bench code. It prints a row per function at 1 Ir or more a request; the grouping into the components below is done by hand from those rows. The totals are of the -g build under callgrind. Under cachegrind, run.mjs --instructions counts a build without debug info at 6,116, 3,490, 3,512, 5,309 and 8,094, within 1.8% of the totals below.

component get short fields0 fields4 fields10
head parse: request line, next, end of head (the rest of http1-codec) 1,303.5 842.6 864.7 1,065.9 1,389.3
head parse: line scan (http1Section less line 1880) 952 260 260 692 1,363
header spans: field lines (http1FieldLine, http1LowerName, http1NonTokenLanes, http1SpanSet, http1FramingField, http1HeadIs, http1HeadIsVector, headerIndex) 1,423 346 346 1,418 3,026
header spans: head copy (http1Section line 1880) 252 24 24 72 156
memcpy 136 57 57 65 112
Host check (std/net/url.ts) 448 361 361 361 361
Date (HttpDate.current 14, HttpDate.formats 1) 15 15 15 15 15
response head, kept path 451 451 451 451 451
sendBody: write and end 86 86 86 86 86
connection, the rest 323 323 323 323 323
JSON writer (the handler) 494 494 494 494 494
bench harness 176 176 176 176 176
total 6,059.6 3,435.6 3,457.8 5,219.0 7,952.3

Instructions a request (Ir), callgrind; this PR's bench code (bench/http1-request/main.ts, bench/http1-request/breakdown.mjs).

  • Header spans. On get, the field lines are http1FieldLine 540, http1HeadIs 353, http1NonTokenLanes 194, http1LowerName (the lowercasing) 176, headerIndex 71, http1SpanSet (the span stores) 40, http1FramingField 29 and http1HeadIsVector 20.
  • Unread fields. From fields0 to fields10, each unread field costs 449.5 Ir. That is 268 Ir of field lines (http1FieldLine 133, http1LowerName 44, http1NonTokenLanes 39, headerIndex 17, http1SpanSet 10, http1HeadIsVector 10, http1FramingField 8, http1HeadIs 7), 110 of line scan, 13 of head copy, 5.5 of memcpy and 52 in the rest of the codec. Cachegrind's slope is 458.2.
  • Response head, kept path. Its 451 Ir are http1ServerKept 99, sameHead 70, http1ServerSame8 64, respond 110, copyBytes 49, bodyRoom 28, http1ServerCopy 20 and begin 11. sameHead compares the kept head, its Date included, and on a match copyBytes copies the kept head whole. http1WriteResponseHead is not in the steady-state profile: it runs only when the status, the fields or the Date change.
  • Connection, the rest. This is inputRoom 64, nextRequest 53, next 27, room 26, acquire 28, OutputPool.take 27, release 16, and 82 Ir of smaller rows. The per-request state reset is http1StartRequest 22 plus Http1Connection.nextRequest 53, 75 Ir.
  • Date. A lean path keeps Date: RFC 9110 §6.6.1 says an origin server with a clock MUST send Date in its 2xx, 3xx and 4xx responses. It costs 15 Ir a request here. HttpDate.current returns the pinned time, or else the time held by hold(), or else reads the clock. Http1Server holds once per readable event (std/net/http1-server.ts, lines 2574 and 2621). bench/http1-request and bench/http1-conn both pin the date, so neither times a clock read inside HttpDate. At 30,000 requests a second over 18,000 connections a readable event mostly carries one request, so the read can be once a request: at the 28.2 ns of the clock read row below, which is the bench's own monotonicNanos read, that is up to about 28 ns a request, and a lean path pays it too. The 29-byte Date copy happens only in http1WriteResponseHead, so the kept-head path does not make it.

Wall clock

node bench/http1-request/run.mjs (this PR's bench code, bench/http1-request/), 12 rounds of 2 columns a case. Each figure is ns a request, median (min–max). The band is the byte-identical copy's median against its build's.

case ns copy band ns per Ir copy ns per Ir
short 302.2 (262.1–409.9) 299.5 (273.0–390.5) ±0.9% 0.088 0.087
get 466.9 (447.9–655.0) 489.3 (449.9–602.9) ±4.8% 0.077 0.081
fields0 286.6 (271.4–436.9) 304.1 (264.9–364.6) ±6.1% 0.083 0.088
fields4 501.2 (392.6–738.7) 530.8 (389.5–629.9) ±5.9% 0.096 0.102
fields10 628.6 (599.3–843.1) 687.3 (601.6–840.8) ±9.3% 0.079 0.086

The ns-per-Ir columns divide each median by the callgrind total above. The per-field slope by wall clock is noisy: 34.2 ns a field from fields0 to fields10, and 53.7 from fields0 to fields4. get less fields0 is 180.3 ns at the medians.

node bench/http1-conn/run.mjs (main at 4d0faa4b, bench/http1-conn/main.ts and run.mjs) times Http1Connection without a socket on the GET of about 350 bytes. Each round is the fastest of 5 batches of 200,000 requests, pinned to core 1. The shapes are:

  • hot: one connection, the GET alone, every line in cache.
  • cold: the GET over 18,000 connections visited round-robin. 18,000 connections hold about 21 MB by the byte counts below, which fits in this box's 260 MiB L3 but not its 2 MiB L2, so cold reaches L3 but not DRAM.
  • idle: an Http1Server-shaped pool with idleInput on: each request is read through the server's scratch buffer, the connection lends its input and head buffers back when it parks, and the requests alternate the GET with a POST of about 550 bytes.
  • idle-dram and direct-dram: idle over 18,000 connections, and its variant that reads into the lent input buffer with no scratch copy, run 20,000 a batch with a 1 GiB eviction ring swept between requests, so every request finds its connection in DRAM. Only the requests are timed, each between two clock reads.

old is main's std/ and old′ a byte-identical copy of its build. new is the working tree, whose std/ is the same 4d0faa4b, so all three columns are one code and their spread is noise.

shape old old′ new
hot, 1 connection 378.6 (374.1–395.0) 377.2 (373.1–394.4) 0.996 375.8 (373.5–396.0) 0.993
cold, 18,000 connections 448.5 (404.0–626.0) 437.2 (401.1–626.5) 0.975 442.8 (404.5–659.9) 0.987
idle-dram, 18,000 connections 732.6 (687.5–794.4) 733.8 (688.0–859.3) 1.002 735.4 (697.3–801.7) 1.004
direct-dram, 18,000 connections 703.0 (669.3–886.0) 687.0 (655.1–756.6) 0.977 688.2 (661.4–786.6) 0.979

15 rounds; ns per request, median (min–max) and ratio of medians to old.

shape old old′ new
hot, 1 connection 386.9 (376.8–475.0) 388.2 (378.3–480.1) 1.003 386.5 (379.1–460.5) 0.999
idle, 1 connection 540.1 (519.7–672.1) 542.2 (524.6–654.2) 1.004 534.2 (517.5–692.7) 0.989

A second run of 15 rounds at one connection: idle does the work of idle-dram, GET and POST through the scratch buffer and the pools, with no eviction ring and no miss. Its hot row is 2.8% slower than the run above, the drift between two runs on this box.

stage old old′ new
recv 57.8 (56.2–60.8) 59.1 (54.3–68.3) 59.0 (56.2–62.2)
parse 353.2 (345.8–370.6) 364.8 (343.9–409.2) 353.3 (345.0–366.3)
dispatch 33.5 (30.9–40.2) 35.1 (29.9–40.4) 33.2 (32.3–34.6)
respond 54.3 (50.7–89.0) 58.7 (49.5–63.4) 52.6 (50.2–56.2)
sendBody 62.4 (19.4–70.1) 72.3 (39.7–149.7) 50.2 (19.4–78.4)
park 15.7 (14.9–16.5) 15.7 (14.6–22.6) 15.6 (15.4–16.5)
total 567.0 (529.5–636.9) 613.8 (535.8–751.7) 551.4 (528.4–611.8)
clock read 28.3 (28.2–28.6) 28.3 (28.2–28.5) 28.2 (28.1–28.3)
sendmsg 543.6 (530.8–588.1) 540.8 (523.8–556.9) 547.1 (533.1–583.3)

Stages on 18,000 connections, 7 rounds, ns per request, with the clock read and sendmsg taken out of each stage. respond is the kept-head path; sendBody is the body write and end.

Bytes per connection

bench/http1-conn/bytes.ts (this PR's bench code) reads Arena.used() around each allocation on the default Http1Config. The arena bump-allocates in 8-byte steps with no per-object header, so these counts include the rounding and there is no allocator header to add. An array is a 24-byte header plus its storage.

object bytes needed
an empty array 24
HttpDate 112 one a server, not a connection
Http1Parser built alone 368
Http1Connection built: the connection 288, its parser 232, the parser's 5 array headers 120, its tally 16, the connection's 3 array headers 72 (noOutput, noFields, headLengths) 728 between requests
after request 1: + the spans, Array<i32>(64), 256 + 24 1,008 per request only, but held
after request 2: + the kept head, 128 + 24, and its field lengths, 8 + 24 (split inferred from the sizes) 1,192 between requests: the kept-head path compares against it
after requests 3 and 4 1,192
lent from the server's pools while a request is served: input 1,024, head 256, output 65,536 0 when idle per request only

The peak RSS of an idle connection, from the 15-round bench/http1-conn/run.mjs run above (main at 4d0faa4b, bench/http1-conn) at 18,000 connections less 0, median (min–max) of 5 runs, in bytes:

old old′ new
idleInput, 1 request 1049 (1048–1049) 1048 (1048–1048) 1049 (1048–1049)
idleInput, 4 requests 1233 (1232–1234) 1232 (1232–1232) 1232 (1232–1233)
idleInput off, 1 request 2918 (2917–2918) 2917 (2917–2917) 2918 (2917–2919)
idleInput off, 4 requests 3102 (3101–3103) 3101 (3101–3101) 3102 (3101–3103)

The object counts are 41 and 40 bytes under these RSS figures, 3–4%: 1,008 against 1,049 after one request (3.9%), and 1,192 against 1,232 after four (3.2%). Where those 40 bytes go is not explained by these runs: the pools' lent buffers, 66,816 bytes shared by the whole pool, come to under 4 bytes a connection, and the rest was not split further. bytes.ts serves a different GET from run.mjs (Host bench.example.com:8080, User-Agent, Accept and Accept-Encoding, a 66-byte body), which does not change what is held. With idleInput off, a parked connection keeps its input and head buffers instead of lending them back, which costs 1,869 bytes more after one request and 1,870 after four, the "about 1.9 KB" of Http1Config.idleInput's doc comment. The lent sizes, 1,024 and 256 with their 24-byte headers, account for 1,328 of it; the other 541 bytes were not split. Of the 1,192 bytes an idle connection holds, the 280 of spans are needed only while a request is served.

Server CPU and idle memory at 18,000 connections

bench/http.mjs drives bench/http1-server.ts with wrk, which is not installed on this box, so it was not used. Both runs below use bench/handler-ring/run.sh --nodb (this PR's bench code, bench/handler-ring/) and its load generator, which offers 30,000 requests a second over 18,000 keep-alive connections, with a 3 s warm-up and a 10 s window. The server runs on CPU 0 and the load generator on CPUs 1–3, under a hard RLIMIT_NOFILE of 20,000. All 18,000 connections were held in every round and none was lost. User and sys are the server's own CPU per request; box µs is the box's non-idle CPU per request from /proc/stat, the load generator's included. Each row is the median of 5 interleaved rounds (min–max), from the per-round srv_us, srv_user_us, srv_sys_us, softirq_us, srv_rss_mb and srv_pss_mb lines.

The real server: the h1 design builds bench/http1-server.ts, which serves through nish/net/handler's HttpHandler and a Router table on top of Http1Server, so h1's CPU includes those layers; the load generator asks it for GET /plaintext, a 129-byte response. h1-copy is a byte-identical copy of its build, which gives the noise band; epoll1 is bench/handler-ring/server.ts on epoll in one process, serving the same route with no SQLite query.

design server µs a request user sys softirq µs box µs RSS MB PSS MB p50 ms p99 ms
h1 12.07 (11.73–13.23) 1.83 (1.67–2.20) 10.27 (9.97–11.03) 13.30 (12.40–14.70) 25.53 24.0 22.7 0.12 0.84 (0.62–1.42)
h1-copy 12.37 (11.46–13.37) 1.93 (1.47–2.13) 10.37 (9.80–11.23) 13.26 25.56 24.0 22.7 0.12 0.74 (0.66–0.90)
epoll1 12.83 (12.17–12.97) 2.07 (1.90–2.33) 10.50 (10.13–10.87) 13.50 26.17 25.1 23.8 0.09 1.10 (0.58–1.42)

The h1 against h1-copy band is 2.5%. h1 holds 18,005 descriptors and epoll1 18,008. h1's median PSS was 22.7 MB: 22.7 MB over 18,000 connections is about 1.26 KB each, which includes the process's own base and its epoll tables, against the 1,192 bytes bytes.ts counts and the 1,232 of peak RSS above.

An earlier run on the same box compared the handler-ring designs:

  • ring: one process on NET_LISTEN_RING.
  • epoll1: one process on epoll.
  • epoll: five SO_REUSEPORT processes on epoll.
  • epoll-copy: a byte-identical copy of epoll's build, which gives the noise band.
design server µs a request user sys box µs softirq µs RSS MB p50 ms p99 ms
epoll1 11.07 (10.60–11.80) 1.80 (1.43–2.07) 9.40 (9.17–9.87) 24.40 12.10 25.1 0.14 0.82
epoll 15.03 (14.23–15.37) 2.77 (2.23–2.83) 12.27 (11.60–12.53) 29.80 14.70 39.7 0.07 0.89
epoll-copy 14.77 (14.37–15.47) 2.87 (2.57–3.07) 12.03 (11.47–12.60) 30.10 14.73 39.7 0.07 0.87
ring 16.93 (16.57–17.20) 2.83 (2.60–3.03) 13.93 (13.53–14.50) 30.24 15.60 31.7 0.04 0.60

The epoll against epoll-copy band is 1.7%. Against epoll's five processes, the ring costs 12.6% more server CPU; against epoll1, the one-process design it replaces, it costs about 53% more (16.93 against 11.07 µs). The script's advisory verdict is no-go. epoll1 measured 11.07 µs in this run and 12.83 µs in the one above, so the box moves by more than either run's band between runs; compare rows within one table. epoll1's median PSS was 23.8 MB in both runs: 23.8 MB over 18,000 connections is under 1.4 KB a connection, with the process base and epoll tables included. These connections were held while the server answered 30,000 requests a second, so they were not strictly idle.

What a lean path could save

The bound adds three things a lean path might remove, each a median widened to the edge of its noise band. A band here is a median's gap to its byte-identical copy's; the min–max spreads in the same tables are 25–50%, so this is not a maximum:

  • Spans of unread fields: 220.2 ns. This is get less fields0 by wall clock, with get 4.8% higher and fields0 6.1% lower, the edges of their bands: 466.9 × 1.048 − 286.6 × 0.939 = 489.3 − 269.1. At the medians it is 180.3 ns. It also includes the line scan of the three unread fields and get's longer Host, which a lean path still pays, so it overstates. Taking only the span work by instructions (field lines, head copy and memcpy, get less fields0: 1,077 + 228 + 79 = 1,384 Ir) at the highest ns per Ir above, 0.102, gives about 141 ns.
  • The per-request state reset: 7.6 ns. That is 75 Ir at 0.1017 ns an Ir, the highest ns per Ir of either column (fields4's copy, 530.8 ns over 5,219 Ir).
  • Cache misses: 218.3 ns. This is the highest idle-dram median of the three columns, 735.4, less the lowest idle median at one connection, 534.2, scaled down by 0.968 for the drift between the two runs (the lowest hot median of the first, 375.8, over the highest of the second, 388.2): 735.4 − 517.1. Within one column the difference is 192.5 in old, 191.6 in old′ and 201.2 in new. It is measured from idle and not hot because idle-dram alternates the GET with a POST of about 550 bytes and reads through the scratch buffer: idle less hot at one connection is about 150 ns of that extra work and no miss, so idle-dram less hot, 735.4 − 375.8 = 359.6 ns, would count it as misses and give a sum of 587.5 ns. The term holds every miss of the request, those on state needed between requests included, and the clock reads around each timed request, so it bounds the misses of state a lean path could drop from above. cold less hot, 448.5 − 375.8 = 72.7 ns at the edges, is the GET's L3 cost on 18,000 connections; idle-dram evicts every line, so its misses are within this term and not added to it. misses.sh was not run, so the term is not split by object.

Date is not counted: a lean path keeps it (RFC 9110 §6.6.1). It is 15 Ir a request, plus up to about 28 ns where a readable event carries one request, and its 29-byte copy happens only when the head is rewritten.

The sum is 220.2 + 7.6 + 218.3 = 446.1 ns, under 0.5 µs by 53.9 ns. At the medians, unscaled (the miss term taken within old's column, without the 0.968 drift factor), it is 180.3 + 7.5 + 192.5 = 380.3 ns. 446.1 ns is 8.7% of the 5.1 µs a no-database 404 costs in the nish-std-amritk challenge entry, about 3 µs of which is in the kernel; those two figures are the entry owner's measurement, not measured here. Against the real server above, it is 3.7% of h1's 12.07 µs of server CPU a request and about 24% of its 1.83 µs of user time.

Verdict: STOP — on medians widened to every term's band edge, a lean request path could save about 0.45 µs a request (446.1 ns), under the 0.5 µs bar and about 9% of the 5.1 µs no-database 404 (the entry owner's figure, not measured here).

SHA-256's block function

Not measured by bench/run.mjs, which carries this section over unchanged. node bench/sha256-block/run.mjs --compiler build/seed/bin/nish times one compression in ns and TSC cycles: Nish's own body (NISH_SHA256=soft), the SHA-NI kernel the compiler puts in front of it, and OpenSSL 3.0.13's sha256_block_data_order with OPENSSL_ia32cap picking its scalar, AVX2 and SHA-NI bodies. bench/sha256-block/README.md has the masks, the short-message and HMAC/HS256/PBKDF2 rows, the variants tried and the target-B commands.

Intel(R) Xeon(R) Processor @ 2.10GHz, 4 cores, TSC 2.100 GHz, std/crypto/sha256.ts at 96a38347. The 16 KiB message (257 blocks), median ns a block (min, spread) and median TSC cycles; runs 1 and 2 are 12 interleaved rounds, run 3 is 26, pinned to one core:

Column run 1 ns run 1 cyc run 2 ns run 2 cyc run 3 ns run 3 cyc
nish soft 212.4 (185.7, 20.7%) 446 218.2 (197.7, 39.6%) 458 208.3 (198.6, 20.7%) 437
nish soft, byte copy 207.5 (189.2, 13.7%) 436 216.7 (196.2, 27.1%) 455 209.2 (202.7, 24.0%) 439
nish (sha-ni) 46.9 (40.2, 62.5%) 98 49.1 (43.7, 45.0%) 103 49.1 (45.7, 33.3%) 103
openssl scalar 174.0 (145.3, 25.3%) 365 182.1 (164.3, 24.7%) 382 182.9 (175.0, 32.2%) 384
openssl avx2 147.8 (139.1, 17.1%) 310 151.2 (139.8, 18.3%) 317 149.3 (141.9, 21.3%) 314
openssl (sha-ni) 41.7 (39.3, 10.0%) 88 42.0 (41.4, 5.5%) 88 41.5 (38.9, 24.3%) 87

The Nish body is 13.9% to 22.1% (22.1%, 19.8% and 13.9%) slower than OpenSSL's scalar body, so the 20% bar for a rewrite was met on one run of three, and 40% to 44% slower than its AVX2 body; the copy's band is 0.4% to 2.3%. openssl speed -evp sha256 gives 182.0 ns a block (scalar), 151.8 (AVX2) and 43.1 (SHA-NI) at 8 KiB, beside the bench's 182.9, 149.3 and 41.5, within about 2%; at 64 B it is 10% to 13% higher, the EVP setup of each call.

The best rewrite of sha256Compress tried (run.mjs --variant locals+maj+nested) was 8% to 9.5% faster (189 to 192 ns against 208, three pinned runs), under the 10% bar, and --cpu x86-64-v3 alone gives as much, so the body is unchanged. Rounds 16 to 63 as a loop over a K table would need module-level constant arrays in the compiler. HMAC-SHA256, HS256 and PBKDF2 (hmacCopySha256) take the SHA-NI kernel by default and the Nish body under NISH_SHA256=soft, shown by their timings here and by a -Wl,--wrap call counter in tests/run.js's "sha256 kernel" section.

A union as a Result's success (WP58 S1)

Not measured by bench/run.mjs, which carries this section over unchanged. bench/union-result/union.ts returns Result<Shape, string>, where Shape is a discriminated union; wrapper.ts is the same program written the way it had to be before a union could be a type argument, Result<ShapeWrapper, string> with the union in a class field. A success allocates the 24-byte result and the 8-byte variant; the wrapper adds its own 8 bytes, so it allocates a quarter more and its resident set grows with it. The union enters the result with a bitcast, so it costs nothing over the variant.

4,000,000 calls of parse, 11 interleaved rounds, medians; node bench/union-result/run.mjs.

variant wall ms vs wrapper bytes per success peak resident KiB
union 67.8 0.80x 32 124128
union2 61.6 0.73x 32 124128
wrapper 84.9 1.00x 40 153184

Noise band (union against its byte-identical copy union2): wall 6.6%, peak resident 0.0%.

io_uring under the handler (WP63 S4)

Not measured by bench/run.mjs, which carries this section over unchanged. bench/handler-ring/server.ts stands in for the entry: an HttpHandler that routes GET /plaintext and answers each request with a post it looks up by a random id in SQLite (bench/sqlite's feed.db and its lookup query), 129 bytes on the wire. One process on io_uring rings (BENCH_RING=1, HandlerLimits.ring) is set against five processes on descriptors (BENCH_CORES=5), the entry's shape, and against a byte-identical copy of the five, whose difference is the noise band. The designs are not alike inside: the ring process has slots = C + 1,024 in one handler and one SQLite connection with its one page cache, while each epoll process has slots = the limit − 64 and its own connection, five page caches in all; that is the entry's shape, and both sides of the comparison carry it. bench/handler-ring/run.sh's loadgen holds C connections open and sends 30,000 requests a second across them; each reading is the server's user plus system CPU over a 10-second window after a 3-second warm-up, divided by the requests answered. The three designs run in turn, in a rotated order, for 5 rounds at each C.

bash bench/handler-ring/run.sh at commit aa0c2058, on an Intel Xeon @ 2.10GHz, 4 vCPUs, 15.7 GiB, kernel 6.18.44 under Docker, with a hard RLIMIT_NOFILE of 20,000 that every server runs under. The edits to run.sh after aa0c2058 (env -u for the variable the other design sets, the trap that stops a server on any exit, and wait_for on the rings line) change how the run starts and stops servers, not what it measures.

C. 18,000 is the stage's own figure, under the limit. The box's C is the highest where the entry's five epoll processes still fit under the limit: five times the limit less 800 descriptors a process keeps for itself, rounded down to a thousand, 5 × (20,000 − 800) = 96,000. Past it the epoll design would need a sixth process, and the comparison would no longer be against the entry's shape. The ring process holds the same C with its slots as the cap: 96,000 is past 65,535, under a limit of 20,000.

Per round, server CPU µs a request:

C round ring epoll epoll copy saving band
18,000 1 26.00 34.27 34.23 24.1% 0.1%
18,000 2 25.63 34.60 34.36 25.9% 0.7%
18,000 3 25.60 35.47 34.60 27.8% 2.5%
18,000 4 25.83 34.23 34.83 24.5% 1.8%
18,000 5 25.57 34.60 34.43 26.1% 0.5%
96,000 1 25.53 36.60 35.63 30.2% 2.7%
96,000 2 25.77 37.10 36.90 30.5% 0.5%
96,000 3 26.23 38.43 38.80 31.7% 1.0%
96,000 4 26.53 37.43 36.87 29.1% 1.5%
96,000 5 26.20 37.17 38.63 29.5% 3.9%

Medians of 5 (min to max). held is the fewest connections up in any round, fds the server's descriptors (summed over five processes), box µs the whole box's CPU a request (the load generator and softirq included) and PSS the server's proportional set size, summed:

C design processes held fds server µs/req box µs/req req/s PSS MB
18,000 ring 1 18,000 13 25.63 (25.57–26.00) 39.37 30,000 102.6
18,000 epoll 5 18,000 18,040 34.60 (34.23–35.47) 51.00 30,000 36.7
18,000 epoll copy 5 18,000 18,040 34.43 (34.23–34.83) 49.93 30,000 36.8
96,000 ring 1 96,000 21 26.20 (25.53–26.53) 37.78 30,000 517.8
96,000 epoll 5 96,000 96,040 37.17 (36.60–38.43) 48.40 30,000 128.8
96,000 epoll copy 5 96,000 96,040 36.90 (35.63–38.80) 49.73 29,999 128.9

At the medians the ring process is 25.9% cheaper at 18,000 against a 0.5% band, and 29.5% cheaper at 96,000 against a 0.7% band. The headline band is the gap between the epoll and epoll-copy medians; a single round's gap is wider, up to 3.9%.

The verdict against design §4 (docs/wp63-iouring-net.md): go. Both halves of the rule hold at the box's C. One process held 96,000 connections, past 65,535, under a limit of 20,000, with 21 descriptors; and it spent 29.5% less CPU a request than five epoll processes, against a 0.7% band. The per-round reading holds as well: the smallest saving in any round was 29.1% at 96,000 (24.1% at 18,000), and the largest band in any round 3.9%. With SQLite and the router on top the saving is larger than the transport's alone (20.0% at 96,000, in bench/README.md), and a request costs the ring process about the same at both Cs while each epoll process pays more at the higher one. That the epoll side pays for its larger descriptor table is an inference, not measured: the five SQLite page caches against one are the other plausible part.

What it costs: memory. The ring process's PSS is 518 MB at 96,000 against 129 MB for the five epoll processes together, about 5.4 KB a connection against 1.3 KB: the slots, their buffers and the rings' own memory. The box as a whole used 1,792 MB against 1,346 MB at 96,000 (the summary's box MB, /proc/meminfo's used memory in the last round of each design).

For D1 (opt-in or default, design §11): the ring path is not dearer at either C measured, so the numbers allow the bit to become the default for the handler's listeners on Linux. Two things stand against doing so here: the memory a connection, which a box sized for epoll may not have (fourfold at 96,000 in this run, 517.8 against 128.8 MB, and 141.4 against 128.9 MB once an idle slot frees its receive queue, below; 2.8 times at 18,000, 102.6 against 36.7 MB, not re-measured), and that neither C here is low. A smoke run at 3,000 (bash bench/handler-ring/run.sh --conns 3000 --rounds 1 --warmup 1 --seconds 2 on the same box) read 23.33 against 33.49 µs with a 0.5% band, but that is a single 2-second window in one round, so it carries no weight here. The bit stays opt-in (HandlerLimits.ring defaults to false) until that choice is made on its own.

What this does not say: the stand-in is not the entry itself, which is not in this repository; its route does one SQLite lookup a request and nothing else. Rerun run.sh on the entry before it switches.

An idle slot's receive queue freed (NURING-38)

Most of the ring process's 518 MB was the slots' receive queues: each slot kept a 4,096-byte queue from its first receive to its close, so a keep-alive connection waiting for its next request held one with nothing in it. The ring listener now frees a queue its reader drains and starts the next at 1,024 bytes (docs/security/net-uring.md, NURING-38). Re-measured with bash bench/handler-ring/run.sh --conns 96000 --compiler build/nish-test at commit f1193f5f, on the same box shape as above (Intel Xeon @ 2.10GHz, 4 vCPUs, 15.7 GiB, kernel 6.18.44 under Docker, hard RLIMIT_NOFILE 20,000), 5 rounds at the defaults:

C round ring epoll epoll copy saving band ring PSS MB
96,000 1 22.00 28.43 28.53 22.6% 0.4% 141.4
96,000 2 21.76 32.50 30.53 33.0% 6.1% 141.5
96,000 3 22.23 29.27 32.50 24.1% 11.0% 141.7
96,000 4 20.37 29.80 29.03 31.6% 2.6% 141.6
96,000 5 20.40 28.17 28.97 27.6% 2.8% 141.4
C design processes held fds server µs/req box µs/req req/s PSS MB box MB
96,000 ring 1 96,000 21 21.76 (20.37–22.23) 30.47 30,000 141.4 1,375
96,000 epoll 5 96,000 96,040 29.27 (28.17–32.50) 41.07 30,001 128.9 1,333
96,000 epoll copy 5 96,000 96,040 29.03 (28.53–32.50) 40.40 30,000 128.8 1,346

The ring process's PSS fell from 517.8 MB to 141.4 MB, about 1.5 KB a connection against the five epoll processes' 1.3 KB (128.9 MB, unchanged from 128.8), and every round read between 141.4 and 141.7 MB. The box's used memory in the last round was 1,375 MB against 1,792 MB before. At the medians the ring process is 25.7% cheaper than the five against a 0.8% band (29.5% against 0.7% before), so the verdict above still holds; this run's single-round bands are wider than S4's, up to 11.0%, and its smallest saving in a round was 22.6%. Both sides read lower in absolute terms than S4's run (29.27 against 37.17 µs for the five), which is the box between runs, not the change: compare within a run, not across them. What the free costs, an allocation and a free per drained read, is not separable here from that drift.

The ring's tail latency, and 300,000 connections

The owner's external entry read a p99 of 65 ms for one ring process against 20 ms for five epoll processes. The runs above measured CPU a request and no latency, so bench/fd-limit/loadgen.c now times every request sent inside the window, from its send to the last byte of its response, into a log-linear histogram (32 buckets an octave, so a percentile reads within about 3%), and run.sh reports p50, p99 and p99.9. With --think S the load is closed-loop: each connection sends its next request S seconds after its last answer, so the offered rate is about C / S and a slow server is offered less.

What this bench shares with the entry: one SQLite lookup a request, and one ring process against five SO_REUSEPORT epoll processes. What it does not: the think time is this bench's choice (the 300,000 run below uses 10 seconds), as are the pinning and the 15-second windows, against the entry's 100-second windows as the owner reported them (not recorded in this tree). The server, all five epoll processes included, runs on CPU 0 (--server-cpus, default 0) and the load on CPUs 1 to 3. The entry's load generator and rate are not known here, and its five epoll processes may have run on several cores while its ring process had one.

The tail does not reproduce at a matched load. bash bench/handler-ring/run.sh --conns 90000 --think T --rounds 2 --warmup 8 --seconds 15 --designs "ring epoll" at commit d603893d, on an Intel Xeon @ 2.10GHz, 4 vCPUs, kernel 6.18.44 under Docker, hard RLIMIT_NOFILE 20,000. The figures are per round (round 1 / round 2):

think offered req/s ring req/s ring µs/req ring p99 ms ring lost epoll req/s epoll µs/req epoll p99 ms epoll lost
3 s 30,000 29,992 / 29,991 18.34 / 18.09 1.02 / 1.04 0 / 0 29,992 / 29,991 25.49 / 27.19 2.53 / 18.18 0 / 2
2.5 s 36,000 35,979 / 35,986 18.70 / 18.54 14.46 / 2.91 0 / 0 35,853 / 35,794 26.40 / 26.15 84.99 / 70.66 15 / 3
2 s 45,000 44,904 / 44,813 17.86 / 18.43 11.65 / 76.80 0 / 0 40,342 / 39,188 24.52 / 25.23 331.78 / 446.46 8 / 7
1.6 s 56,250 52,868 / 53,094 18.38 / 17.96 182.27 / 231.42 7 / 0 39,693 / 39,180 24.96 / 25.30 778.24 / 794.62 4 / 0

The p99 column is noisy, far more than the CPU columns. The same design at the same load moved by as much as 7.2× between the two rounds of this table (epoll's 2.53 against 18.18 ms at 3 s; the ring's largest was 6.6×, 11.65 against 76.80 ms at 2 s), and by 11.8× across the three rounds at 96,000 connections below (epoll's 2.27 to 26.88 ms), where epoll and its byte-identical copy read median p99s of 8.83 and 3.87 ms against a CPU band of 0.8%. Read a p99 here by its order of magnitude and by which side is lower in each round, not by its digits. The p99 is also right-censored: a request still unanswered 2 s after the window closes is counted in lat_lost, not in the histogram, so it is missing from the percentiles. The lost columns are those counts: at most 15 of the about 450,000 to 800,000 requests timed in a round of this table, too few to move a p99. The loadgen of these runs closed its window only after take()'s sample reads at its end, not after its last /proc reads (the memory and descriptor counts that follow), so a request sent during the sample reads counted as timed but could not count as answered; these counts include any such request. loadgen now closes the window before those reads, run.sh warns on any lat_lost above 0, and it reports lat_lost in a lost column, which the runs below predate: their runs' counts were at most 8 a round at 18,000, 8 at 96,000 and 10 at 300,000.

In every round at every load the ring process's p99 was below the five's on the same core. Both tails grow as the load nears what one core can serve: on this 2.10GHz box, about 53,000 requests a second for the ring process (about 18 µs a request) and about 40,000 for the five (about 25 µs). At the 2-second and 1.6-second thinks the five were saturated: they served about 40,000 of the 45,000 and 56,250 offered, so their p99 there is a backlog that grows for the whole window, not a tail at the same load as the ring's. At 2.5 seconds they were near saturation: they served 35,853 and 35,794 of 36,000, about 0.94 of the core at their 26 µs a request, with p99s of 85.0 and 70.7 ms. At 1.6 seconds the ring process was saturated too, at about 53,000 of 56,250. Two longer runs at a light load, 3 rounds each, read the same way:

  • --conns 90000 --think 4 --rounds 3 --warmup 8 --seconds 15 --designs "ring epoll epoll-copy" at d603893d, at 22,500 req/s: the ring process read a p99 of 0.70 to 0.76 ms against 1.23 to 1.39 ms for the five.
  • --conns 18000 --think 0.8 --rounds 3 --warmup 5 --seconds 15 --designs "ring epoll epoll-copy epoll1" at d603893d, same rate: the ring process read 1.65 to 1.78 ms, the five 2.08 to 3.17 ms, and one epoll process 1.49 to 1.84 ms.

One epoll process at the same rate tails too. The control for "one ring process" is one epoll process (epoll1) on the same core, but it cannot hold 90,000 connections here: it opens a descriptor a connection, the box's hard RLIMIT_NOFILE is 20,000, and run.sh gives it at most 20,000 - 64 = 19,936 slots and skips it above that. Raising the hard limit needs CAP_SYS_RESOURCE, which this container's root lacks (prlimit --nofile=200000:200000 answers "Operation not permitted"). So the control runs at 18,000 connections and the rate of the 90,000 runs, with a think time five times shorter: bash bench/handler-ring/run.sh --conns 18000 --think T --rounds 2 --warmup 8 --seconds 15 --designs "ring epoll1 epoll", the 0.4-second rows at commit 877c503e and the 0.5-second rows at c1b8967f, on an Intel Xeon @ 2.30GHz, 4 vCPUs, kernel 6.18.44 under Docker, hard RLIMIT_NOFILE 20,000. Per round (round 1 / round 2):

think offered req/s ring µs/req ring p99 ms epoll1 µs/req epoll1 p99 ms epoll µs/req epoll p99 ms
0.5 s 36,000 14.78 / 15.18 8.13 / 5.57 18.37 / 17.55 4.67 / 4.93 23.10 / 23.17 36.35 / 17.15
0.4 s 45,000 14.29 / 14.61 12.67 / 7.10 18.46 / 17.65 40.45 / 27.39 22.58 / 22.12 53.76 / 38.40

Every round served within 1.2% of the offered rate but the five's first at 45,000, at 43,250. At 36,000 a second one epoll process's p99 was 4.7 to 4.9 ms, lower than the ring's 5.6 to 8.1; at 45,000 it was 27 to 40 ms, about three times the ring's 7.1 to 12.7, with the five at 38 to 54. A single process on one core tails at these rates whichever readiness API it uses; the ring's lower CPU a request keeps it further from the core's limit, which fits the order flipping at the higher rate. The 0.5-second rows' loadgen, at c1b8967f, prints send_failed and closed, and both read 0 in every one of their runs; the 0.4-second rows' loadgen, at 877c503e, prints neither. The 0.8-second run above, at 22,500 a second, is the same control at a light load.

What the tail is: a queue on one core, not a stall. The trace is in the tree: bench/handler-ring/trace.patch adds per-second counters to runtime/runtime-net.c's nr_pump, nr_collect and nr_poll_wait (its header says how each field is computed), and bash bench/handler-ring/trace.sh 90000 2 applies it for one build, runs the ring server on CPU 0 at 90,000 connections and a 2-second think, and reverts it. Every counter line starts with its CLOCK_MONOTONIC second, and loadgen's line ends with its window's bounds on the same clock, so trace.sh copies the seconds wholly inside the window to build/bench/handler-ring/trace-window.err; the full trace, connect phase and warm-up included, is trace.err. One run, with runtime/ as at 0c6cdaa7 and bench/ (trace.patch, trace.sh, loadgen) as at 1b3a92ee, on the 2.30GHz box above, read the line below. That loadgen predates the window-close fix above; it prints every counter quoted here.

label=trace conns=90000 up=90000 failed=0 clients=5 connect_s=6.3 rps=44975 srv_us=16.76 srv_user_us=4.54 srv_sys_us=12.23 box_us=23.75 softirq_us=7.65 srv_rss_mb=136.8 srv_pss_mb=135.3 srv_fds=21 mem_used_mb=1356 tcp_mem_mb=0 starved=0 sent=1034304 think_s=2.00 p50_ms=0.552 p99_ms=15.744 p999_ms=25.344 max_ms=28.416 lat_n=674621 lat_lost=0 send_failed=0 closed=0 win_lo=188.861 win_hi=203.862

This run's p99, 15.7 ms, lies between the ring's two 2-second rows in the 90,000 table, 11.65 and 76.80 ms, but that is a cross-host comparison: those ran on the 2.10GHz box, this on a 2.30GHz one, and the p99 band is wide even on one box. The window held 14 whole seconds. The second with the longest pass and the oldest ready slot, and the second with the next longest pass, verbatim from trace-window.err:

tr2 t=191.556 ages=43247 max_age=19.37 ah(>1,2,5,10,20,50,100)=13506,11430,7272,4248,0,0,0 max_list=1456 taskrun=2956 overflow=0 nobufs=0 requeues=0 live=90000
trace t=191.556 cycles=1826 pumps=2263 ev=43252 waits=4881 sleeps=435 sleep_full=0 max_cycle=4.63 max_out=2.34 n_at_max=43 max_in=5.08 max_pump=2.28 max_pump_ev=208 max_rounds=10 max_wait=2.201 max_sleep=4.97 max_npend=0 max_cycle_pumps=1 max_cycle_ev=208 h(>1,2,5,10,20,50,100)=302,2,0,0,0,0,0
tr2 t=194.557 ages=46767 max_age=26.17 ah(>1,2,5,10,20,50,100)=9322,4798,4109,3478,1662,0,0 max_list=1910 taskrun=31745 overflow=0 nobufs=0 requeues=0 live=90000
trace t=194.557 cycles=1978 pumps=2475 ev=46805 waits=5483 sleeps=496 sleep_full=0 max_cycle=8.60 max_out=0.56 n_at_max=64 max_in=8.05 max_pump=8.03 max_pump_ev=408 max_rounds=10 max_wait=7.711 max_sleep=2.83 max_npend=0 max_cycle_pumps=1 max_cycle_ev=408 h(>1,2,5,10,20,50,100)=232,11,1,0,0,0,0

In the window's 14 seconds (43,145 to 46,805 completions a second, live=90000 throughout):

  • The longest pass of nr_poll_wait and the handler took 8.60 ms (max_cycle). The fields assigned with it say that pass spent 0.56 ms in the handler (max_out) on the 64 ready slots the previous return handed it (n_at_max, which the chunk of 64 caps), and pumped once, 408 completions (max_cycle_pumps, max_cycle_ev). That second's longest pump, 8.03 ms over 408 completions (max_pump, max_pump_ev), is the same count, and it fits in that pass: the pass's 8.60 ms less 0.56 ms in the handler leaves at most 8.04 ms, and only one pass that second took over 5 ms. So most of the pass was that one pump, about 20 µs a completion in that pump, a second's maximum and not the typical cost: over the whole run a request cost 16.76 µs of server CPU, 12.23 of it system time (srv_us, srv_sys_us). The next longest pass in the window, 4.63 ms, spent 2.34 ms in the handler on 43 slots and pumped 208. max_in, max_wait and max_pump are maxima over all of a second's passes, not fields of its longest. In no window second did more than 11 passes take over 2 ms, only one pass took over 5 ms, and none over 10 ms.
  • In every second of the trace no completion overflowed the ring (overflow), no send was requeued (requeues), and no receive on an unheld slot ended for want of a buffer (nobufs, the set's nobufs_rearms; a held slot's receive that ends so is not counted). max_rounds, the nish_uring_wait calls in one pump, peaked at 31 in the window (t=203.559), below nr_pump's cap of 64, and was 10 in the second of the longest pass, so no pump in the window stopped at its cap.
  • The oldest ready slot in the window had waited up to 26.2 ms, in the second of the longest pass: max_age is an upper bound, since nr_collect re-appends every slot it reports and the re-append stamps the slot then, so a slot's age can start before the event it is next collected for arrived. 1,662 of the 46,767 slots taken that second read more than 20 ms old, by the same upper-bound age, and none more than 50 ms, and the list held at least 1,910 slots at once (max_list is read every 64th collection, so it is a lower bound). loadgen's own maximum over the window, 28.4 ms (the midpoint of its top histogram bucket, so within about 1.6%), is the same size. The handler takes the list in arrival order, at most 64 slots a wait, so the last slot in a burst waits for the whole burst.
  • The warm-up, outside the window, was worse: two seconds read 64.7 and 58.7 ms ages with lists of 4,800 and 5,033 slots, and one connect-phase second read a 339.5 ms pass while the connections were being opened. An earlier trace, with bench/ as at c1b8967f, read a second of 5,163 slots and a 63.2 ms age; its lines carry no clock stamp, so that second cannot be placed against its loadgen window, whose maximum was 45.6 ms. As an upper bound, the 63.2 ms age does not contradict that maximum.

That second also shows where the long pump's time went. Its longest single nish_uring_wait, with a timeout of 0, so one that never blocks, took 7.7 ms (max_wait). A pass holds its waits, and only one pass that second took over 5 ms, so that wait was in the longest pass, inside its one pump of 8.03 ms; and the ring set re-entered the kernel to run its deferred task work (taskrun, the set's taskrun_reentries, counted on the ring's IORING_SQ_TASKRUN flag in runtime/runtime-uring.c's ur_service) 31,745 times that second, against 2,956 to 18,469 in the window's other seconds. The trace does not time the task work; that the long wait was the kernel completing the queued requests' work inside the call, the 408 completions of that pump, and not the process asleep or blocked, is an inference from the taskrun count and a timeout of 0: a queue, not a stall. Two other candidate causes are ruled out for the window and one is not: no connection opened or closed in it (live=90000 in every second, and loadgen's up=90000, closed=0), so no accept completed and no accept re-arm or batching ran in it (the trace's struct carries the accept-error and accept-pause counts but does not print them); the re-arm of a receive whose multishot ended is not counted, so the trace cannot rule its cost in or out.

The bursts come, by inference, from the load itself; the trace does not observe the load generator. A closed loop with one fixed think time sends a connection's next request at a fixed interval after its last answer, so the requests a slow moment delays arrive together again one think time later. A server on more cores drains the same burst sooner, which is consistent with the entry's five epoll processes on several cores against one ring process on one. That is an inference: the entry's cores were not measured here. The ring process's own CPU a request, 18 µs against the five's 25 µs on the 2.10GHz box (15 against 23 µs at 18,000 connections on the 2.30GHz one), is what decides how near its core it runs at a given rate.

No fix is made in this stage. Pumping is not cheap overhead to bound: a pumped completion carries the kernel work of a request, and bounding the pump would move that work between passes, not remove it. That the work is most of the run's 16.76 µs a request is an inference, not a measurement: the trace counts completions, not the CPU each costs, and the inference rests on 12.23 µs of the 16.76 being system time. The batch of 64 is NISH_POLL_CHUNK in runtime/runtime-net.c, which caps a wait below the bench's limits.maxEvents of 128 (set in bench/handler-ring/server.ts; std/net/handler.ts's default is 256); a smaller one would reorder the same queue. What should shorten the tail is a second core, with one ring process for each core, or smaller bursts from the load. Neither is measured here.

The final code at the box's C. bash bench/handler-ring/run.sh --conns 96000 --think 4 --rounds 3 --warmup 8 --seconds 15 --designs "ring epoll epoll-copy" at commit d603893d, on an Intel Xeon @ 2.30GHz, 4 vCPUs, 15.7 GiB, kernel 6.18.44 under Docker, hard RLIMIT_NOFILE 20,000, at 24,000 req/s:

C round ring epoll epoll copy saving band
96,000 1 21.62 31.45 31.78 31.3% 1.0%
96,000 2 20.86 31.17 31.20 33.1% 0.1%
96,000 3 20.62 30.37 31.42 32.1% 3.5%
C design processes held fds server µs/req box µs/req req/s PSS MB box MB p50 ms p99 ms p99.9 ms
96,000 ring 1 96,000 21 20.86 (20.62–21.62) 30.53 23,994 141.8 1,400 0.17 1.74 (1.55–1.78) 10.11
96,000 epoll 5 96,000 96,040 31.17 (30.37–31.45) 41.65 23,995 129.2 1,322 0.24 8.83 (2.27–26.88) 29.44
96,000 epoll copy 5 96,000 96,040 31.42 (31.20–31.78) 41.53 23,996 129.2 1,327 0.24 3.87 (2.21–17.66) 19.71

Medians of 3 (min to max), and box MB from the last round of each design, as above. These rounds predate 02230cc8's ten-minute idleTimeout (below), which does not touch them: opening 96,000 connections took 4.7 to 6.1 s, far inside the 60-second default. They also predate loadgen's send_failed and closed counters, so they do not show that every connection kept sending; every round answered within 0.03% of the offered 24,000 a second. The ring process is 33.1% cheaper than the five at the medians, against a 0.8% band, and its p99 was lower than either epoll build's in every round. The p99 band is far wider than the CPU band: epoll and its byte-identical copy read 8.83 and 3.87 ms at the medians, 2.27 to 26.88 and 2.21 to 17.66 ms across rounds. Its PSS, 141.6 to 141.8 MB, has ends 0.2 and 0.1 MB above those of the 141.4 to 141.7 MB NURING-38 measured. The verdict still holds.

300,000 connections, one ring process. bash bench/handler-ring/run.sh --conns 300000 --think 10 --rounds 3 --warmup 15 --seconds 15 --designs ring at commit 02230cc8, on the same 2.30GHz box, at 30,000 req/s. There is no epoll row. Under this limit five epoll processes hold 96,000 connections between them, so 300,000 would need sixteen.

C design processes held fds server µs/req box µs/req req/s PSS MB box MB p50 ms p99 ms p99.9 ms
300,000 ring 1 300,000 47 23.73 (23.67–24.16) 36.80 29,998 436.3 3,075 0.12 0.90 (0.87–2.59) 8.83

Medians of 3 (min to max). These rounds also predate the send_failed and closed counters; each answered 29,998 a second of the offered 30,000. One process held 300,000 connections in every round, under a limit of 20,000, with 47 descriptors. Its PSS was 435.9 to 436.3 MB, about 1.5 KB a connection, about the same as at 96,000. A request cost 23.73 µs against 20.86 at 96,000, though at a different rate, so the two are not a like-for-like comparison.

Opening the connections took 90.6 to 123.7 s. The first run, at d603893d, answered no requests at all: past the handler's 60-second default idleTimeout the server closed the first connections before the window opened, and the load generator does not reopen a closed connection. bench/handler-ring/server.ts now sets limits.http.idleTimeout to ten minutes. That is a setting of the bench, not of the ring.

The cheaper wins for five processes (WP63 S5)

Not measured by bench/run.mjs, which carries this section over unchanged. The stand-in is S4's (bench/handler-ring/server.ts, above), run only as the entry's five SO_REUSEPORT processes on descriptors (BENCH_CORES=5). bench/handler-ring/wins.sh sets each of design §9's cheaper wins (docs/wp63-iouring-net.md) against the unchanged five, each on its own, in interleaved rounds with the order rotated each round:

  • epoll: the baseline, as run.sh runs it.
  • epoll copy: a byte-identical copy of the baseline's build; its gap to the baseline is the noise band.
  • mmap: BENCH_MMAP=1, which runs PRAGMA mmap_size=268435456 on each worker's connection after it opens (each worker reads it back; the run refuses to go on unless SQLite reports 268,435,456). feed.db is 268,263,424 bytes, so the whole file fits the map.
  • shm: BENCH_CACHE=shm, a cache of each post's like count, the part of the lookup that counts rows, in one nish/sync/shm region of 2 MB that the supervisor makes and the five workers map. A request whose post is cached is answered from the region without SQLite; a miss runs the lookup and stores the count with a relaxed atomic store.
  • private: BENCH_CACHE=private, the same cache in each worker's own memory: the per-process state the shared region replaces. It is there to say how much of the shm arm's figure comes from sharing, not to be a win of its own.

Nothing writes the database, so neither cache can go stale here; an entry that writes would have to invalidate. Each cache starts empty with its server and fills as random ids arrive, so its hit rate climbs through a run. hit is the cache's hits over every request the workers answered, warm-up included (each worker prints its counts every 4,096 requests; the last line of each is summed).

bash bench/handler-ring/wins.sh --rounds 7 at commit 6ad0eca5 on this pull request's branch (later commits change only documentation), on an Intel Xeon @ 2.10GHz, 4 vCPUs, 15.7 GiB, kernel 6.18.44 under Docker, with a hard RLIMIT_NOFILE of 20,000 that every server runs under. 18,000 connections, 30,000 requests a second, a 3-second warm-up and a 10-second window, 7 rounds of the five arms. The box may be shared with another session running tests; the load average read 2.0 to 2.5 at the run's end, which the run itself (five servers and the load generator) accounts for. One reading looks disturbed: epoll's whole-box figure in round 5, 65.87 µs against 47 to 51 in every other round, while its server figure that round (33.07) is in line, so the server figures are what this section reads.

Per round, server CPU µs a request, and each win's change against epoll in the same round:

round epoll epoll copy mmap shm private band mmap shm
1 34.40 32.33 26.77 29.70 33.23 6.0% −22.2% −13.7%
2 32.93 32.87 28.63 28.53 32.97 0.2% −13.1% −13.4%
3 32.90 32.47 27.20 28.67 32.40 1.3% −17.3% −12.9%
4 34.20 33.07 27.87 28.10 32.67 3.3% −18.5% −17.8%
5 33.07 33.56 28.23 28.13 29.80 1.5% −14.6% −14.9%
6 32.00 33.07 28.37 27.50 31.70 3.3% −11.3% −14.1%
7 33.30 32.87 27.63 27.80 31.44 1.3% −17.0% −16.5%

Medians of 7 (min to max). user and sys are the means of the server's user and system CPU a request; PSS and RSS are summed over the five workers (the supervisor, which maps the shm region too, is not counted); box MB is /proc/meminfo's used memory, the median of the rounds:

arm server µs/req user sys box µs/req req/s PSS MB RSS MB box MB hit
epoll 33.07 (32.00–34.40) 11.66 21.60 49.47 30,000 36.7 49.2 834 —
epoll copy 32.87 (32.33–33.56) 11.66 21.23 49.90 30,000 36.8 49.2 827 —
mmap 27.87 (26.77–28.63) 11.65 16.16 44.33 30,000 279.4 1,300.7 827 —
shm 28.13 (27.50–29.70) 9.46 18.89 45.47 30,000 38.7 58.8 845 30.0%
private 32.40 (29.80–33.23) 11.39 20.64 48.43 29,999 46.3 58.8 846 7.3%

The noise band is 0.6% at the medians (epoll against its copy) and at most 6.0% in any one round.

PRAGMA mmap_size: a gain. 15.7% less server CPU a request at the medians (27.87 against 33.07 µs), against a 0.6% band; the smallest saving in any round, 11.3%, is above the largest single-round band, 6.0%. The whole saving is system time (16.16 against 21.60 µs; user time is unchanged), which is what skipping a pread and its copy per page read should show. Memory does not fall, on any measure this run took. RSS rises to 1,301 MB, as each worker counts all 256 MB of the mapped file; PSS rises to 279 MB, as the five split those pages between them; and the box's used memory is the same as the baseline's (827 against 834 MB), so the pages the map shows were the page cache the baseline reads through pread already, now counted against the processes. A tool that reads RSS or PSS will report the server as larger.

Shared state in nish/sync/shm: a gain, which is mostly the cache's. The shared cache spent 14.9% less a request at the medians (28.13 against 33.07 µs), against a 0.6% band, and at least 12.9% less in every round, above the largest single-round band. It answered 30.0% of requests without SQLite. The same cache held privately answered 7.3% and saved 2.0% at the medians, which is outside the median band but not outside the per-round one (its per-round change runs from 0.0% to −9.9%), so this run does not separate it from noise. What sharing bought here is the hit rate: five workers fill one table about four times as fast as each fills its own, from cold. The memory is small either way, 38.7 MB PSS shared against 46.3 MB private (2 MB a table, once against five times). Both figures are for a cache that starts empty, over a 13-second run across 500,000 ids. A server that runs long enough to cache every post would answer every request from either cache, and sharing would then save only the four extra copies and the time to fill them. So the 14.9% is the stand-in's figure for this cache at this age, not a property of nish/sync/shm. The region's own cost per access, one atomic load on a hit and one store on a miss, did not show as a loss.

What this does not say: the stand-in is not the entry, and its one route is a read; writes go through the WAL and an mmap gains them nothing (design §9). Only 18,000 connections were measured. Rerun wins.sh on the entry before it adopts either.

Crypto against other languages

Written by node bench/crypto/run.mjs --record, not by bench/run.mjs, which carries this section over when it rewrites the file. The programs, the inputs and the measurement rules are in bench/crypto/README.md.

Each cell is the median of the column's own timed loop over the rounds, every column at one iteration count per row, the order rotated each round and reversed on every other block. The last two columns divide Nish portable's median time by the fastest portable twin's (no assembly: OpenSSL under an OPENSSL_ia32cap mask, Go -tags purego, RustCrypto's soft backend), and Nish's by the fastest default twin's (assembly and CPU extensions allowed); above 1.000x Nish is slower. Nish portable is the Nish binary with its runtime's AES-NI and PCLMULQDQ, ChaCha20 vector and SHA-NI kernels pinned off (NISH_AES, NISH_CHACHA20 and NISH_SHA256 set to soft); a family that calls none of them runs the same code in both columns. Every cell more than 1.5x behind the best portable twin is analysed in docs/crypto-performance.md. The Band column is the row's noise band, the gap between Nish and a byte-identical copy of its binary, and each quotient beside it is read against it: within the band is no difference.

Machine: Intel(R) Xeon(R) Processor @ 2.30GHz (x64, 4 CPUs); flags: aes yes, pclmulqdq yes, sha_ni yes, avx2 yes, avx512f yes.

Toolchains: Nish 0.42.0; Ubuntu clang version 18.1.3, OpenSSL 3.0.13 30 Jan 2024 (Library: OpenSSL 3.0.13 30 Jan 2024); go version go1.26.0 linux/amd64; rustc 1.97.0 (2d8144b78 2026-07-07); Node v22.23.5. 11 round(s) asked, each case rounded up to a multiple of twice its columns.

AES-GCM and ChaCha20-Poly1305 (bench/crypto/aead)

Kernel Size Unit Nish Nish portable OpenSSL OpenSSL portable Go Go purego Rust Rust soft Node Band Nish / best portable Nish / best assembly
aes128gcm-seal 64 B MB/s 291 53.9 299 80.4 443 85.7 318 75.7 17.3 ±0.8% 1.589x slower (go-purego) 1.522x slower (go)
aes128gcm-seal 1350 B MB/s 708 93.7 822 121 803 127 717 130 152 ±0.1% 1.393x slower (rust-soft) 1.161x slower (openssl)
aes128gcm-seal 16 KiB MB/s 753 96.8 890 125 842 131 771 137 628 ±0.7% 1.414x slower (rust-soft) 1.182x slower (openssl)
aes128gcm-seal 1 MiB MB/s 724 98.4 854 125 821 130 761 135 635 ±2.8% 1.376x slower (rust-soft) 1.180x slower (openssl)
aes128gcm-open 64 B MB/s 324 54.9 329 82.6 576 87.1 364 78.1 23.4 ±1.7% 1.586x slower (go-purego) 1.779x slower (go)
aes128gcm-open 1350 B MB/s 700 90.7 813 121 816 126 729 127 197 ±0.2% 1.406x slower (rust-soft) 1.166x slower (go)
aes128gcm-open 16 KiB MB/s 758 98.1 892 126 850 132 785 137 647 ±0.6% 1.395x slower (rust-soft) 1.176x slower (openssl)
aes128gcm-open 1 MiB MB/s 532 99.3 822 126 717 130 723 135 665 ±8.0% 1.355x slower (rust-soft) 1.545x slower (openssl)
aes256gcm-seal 64 B MB/s 288 44.7 295 66.2 420 75.6 305 63.9 18.7 ±1.4% 1.693x slower (go-purego) 1.458x slower (go)
aes256gcm-seal 1350 B MB/s 697 76.4 815 96.6 785 113 702 111 172 ±0.9% 1.483x slower (go-purego) 1.169x slower (openssl)
aes256gcm-seal 16 KiB MB/s 744 82.0 891 97.7 828 118 780 117 650 ±0.2% 1.437x slower (go-purego) 1.197x slower (openssl)
aes256gcm-seal 1 MiB MB/s 709 81.8 874 96.3 805 117 743 118 655 ±1.4% 1.438x slower (rust-soft) 1.233x slower (openssl)
aes256gcm-open 64 B MB/s 317 45.7 329 69.2 549 79.3 364 67.1 22.3 ±1.4% 1.734x slower (go-purego) 1.730x slower (go)
aes256gcm-open 1350 B MB/s 695 76.6 821 95.8 807 114 726 112 196 ±0.6% 1.490x slower (go-purego) 1.182x slower (openssl)
aes256gcm-open 16 KiB MB/s 741 81.3 891 97.6 840 116 782 118 659 ±0.7% 1.455x slower (rust-soft) 1.202x slower (openssl)
aes256gcm-open 1 MiB MB/s 637 81.2 844 98.3 748 116 731 117 697 ±2.6% 1.438x slower (rust-soft) 1.325x slower (openssl)
chacha20poly1305-seal 64 B MB/s 137 138 98.6 173 285 172 45.2 179 13.4 ±1.2% 1.299x slower (rust-soft) 2.076x slower (go)
chacha20poly1305-seal 1350 B MB/s 395 242 533 549 628 332 351 317 150 ±0.4% 2.266x slower (openssl-portable) 1.589x slower (go)
chacha20poly1305-seal 16 KiB MB/s 456 261 703 637 684 360 550 345 498 ±0.7% 2.443x slower (openssl-portable) 1.541x slower (openssl)
chacha20poly1305-seal 1 MiB MB/s 454 266 760 638 688 359 551 337 572 ±0.4% 2.396x slower (openssl-portable) 1.673x slower (openssl)
chacha20poly1305-open 64 B MB/s 149 148 125 174 307 168 46.2 188 18.6 ±0.5% 1.267x slower (rust-soft) 2.064x slower (go)
chacha20poly1305-open 1350 B MB/s 395 246 574 556 649 338 357 322 198 ±0.9% 2.262x slower (openssl-portable) 1.643x slower (go)
chacha20poly1305-open 16 KiB MB/s 462 262 704 647 691 366 541 347 521 ±0.7% 2.468x slower (openssl-portable) 1.525x slower (openssl)
chacha20poly1305-open 1 MiB MB/s 447 258 751 612 674 352 543 331 636 ±0.4% 2.374x slower (openssl-portable) 1.680x slower (openssl)
  • Node has no portable column: node is OpenSSL's libcrypto with its assembly, and Node has no switch that turns it off
  • Node keys a cipher per message, since node holds no expanded key across nonces; the other twins key once, before the clock.

X25519, P-256 and Ed25519 (bench/crypto/curves)

Kernel Size Unit Nish Nish portable OpenSSL OpenSSL portable Go Go purego Rust Rust soft Node Band Nish / best portable Nish / best assembly
x25519-base 32 B op/s 12,542 12,486 29,446 — 30,436 24,967 84,357 — 15,803 ±3.4% 2.000x slower (go-purego) 6.726x slower (rust)
x25519 32 B op/s 12,470 12,506 31,520 29,187 30,464 25,081 26,921 — 25,430 ±0.4% 2.334x slower (openssl-portable) 2.528x slower (openssl)
p256-sign 64 B op/s 16,417 15,965 53,682 51,782 34,099 15,590 32,321 — 42,106 ±1.2% 3.243x slower (openssl-portable) 3.270x slower (openssl)
p256-verify 64 B op/s 2,992 2,959 16,664 18,079 16,144 6,883 9,123 — 15,771 ±0.0% 6.110x slower (openssl-portable) 5.569x slower (openssl)
ed25519-sign 64 B op/s 4,808 4,784 30,906 — 62,888 51,444 77,460 — 29,557 ±1.4% 10.753x slower (go-purego) 16.109x slower (rust)
ed25519-verify 64 B op/s 4,918 4,913 11,286 — 25,849 21,498 33,140 29,797 10,381 ±0.4% 6.065x slower (rust-soft) 6.738x slower (rust)
  • OpenSSL has no portable x25519-base: OpenSSL's X25519 of the base point runs the same C (fe51) code whatever the mask
  • OpenSSL has no portable ed25519-sign: OpenSSL's Ed25519 runs the same C curve code whatever the mask; only its SHA-512 changes
  • OpenSSL has no portable ed25519-verify: OpenSSL's Ed25519 runs the same C curve code whatever the mask; only its SHA-512 changes
  • Rust has no portable x25519-base: curve25519-dalek's base-point multiply is table code, the same whichever backend
  • Rust has no portable x25519: curve25519-dalek's Montgomery ladder is serial field code, the same whichever backend
  • Rust has no portable p256-sign: RustCrypto's p256 is pure Rust, so there is no assembly to switch off
  • Rust has no portable p256-verify: RustCrypto's p256 is pure Rust, so there is no assembly to switch off
  • Rust has no portable ed25519-sign: ed25519-dalek's signing multiplies the base point by table, the same whichever backend
  • Node has no portable column: node is OpenSSL's libcrypto with its assembly, and Node has no switch that turns it off

TLS 1.3 and QUIC handshakes (bench/crypto/handshake)

Kernel Size Unit Nish Nish portable OpenSSL OpenSSL portable Go Go purego Rust Rust soft Node Band Nish / best portable Nish / best assembly
tls13 32 B op/s 1,116 1,034 2,170 — 2,700 1,701 5,052 — 992 ±0.2% 1.645x slower (go-purego) 4.528x slower (rust)
quic 32 B op/s 1,052 901 — — 1,338 833 3,529 — — ±10.8% 0.924x within the band (go-purego) 3.354x slower (rust)
  • OpenSSL has no quic: This twin drives OpenSSL 3.0's libssl, which has no QUIC server (that came in 3.5)
  • OpenSSL has no portable column: OpenSSL's P-256 and X25519 assembly runs whatever OPENSSL_ia32cap says: masking every bit it reads moves a handshake by under 10% (README.md), so no mask makes a column that proves anything
  • Rust has no portable column: ring picks its assembly at run time and has no feature or cfg that turns it off
  • Node has no quic: Node has no stable QUIC
  • Node has no portable column: node is OpenSSL's libssl with its assembly, and Node has no switch that turns it off
  • Every QUIC column runs in memory, with no socket: Nish and Rust (quinn-proto) hand each datagram to the other endpoint, and Go runs quic-go over a pair of in-memory net.PacketConns.
  • Node's server sends OpenSSL's default two TLS 1.3 tickets, which node cannot turn off; every other twin sends none, and nothing resumes.

SHA-2, HMAC and HKDF (bench/crypto/hash)

Kernel Size Unit Nish Nish portable OpenSSL OpenSSL portable Go Go purego Rust Rust soft Node Band Nish / best portable Nish / best assembly
sha256 64 B MB/s 180 115 430 163 391 119 631 184 47.2 ±0.3% 1.598x slower (rust-soft) 3.510x slower (rust)
sha256 1 KiB MB/s 1,135 330 1,555 396 1,526 259 1,676 366 549 ±0.4% 1.199x slower (openssl-portable) 1.477x slower (rust)
sha256 1 MiB MB/s 1,686 364 1,850 427 1,859 280 1,873 388 1,836 ±0.0% 1.170x slower (openssl-portable) 1.111x slower (rust)
sha512 64 B MB/s 80.9 80.6 196 182 201 150 235 211 40.5 ±1.3% 2.612x slower (rust-soft) 2.899x slower (rust)
sha512 1 KiB MB/s 306 304 659 571 586 369 615 488 376 ±0.4% 1.876x slower (openssl-portable) 2.157x slower (openssl)
sha512 1 MiB MB/s 402 402 807 691 720 437 694 559 801 ±0.6% 1.721x slower (openssl-portable) 2.009x slower (openssl)
hmac-sha256 64 B MB/s 83.7 46.0 89.1 50.1 114 38.9 282 74.0 38.2 ±5.7% 1.609x slower (rust-soft) 3.371x slower (rust)
hmac-sha256 1 KiB MB/s 753 255 857 295 956 200 1,401 301 478 ±1.5% 1.180x slower (rust-soft) 1.861x slower (rust)
hkdf-sha256 32 B op/s 403,749 260,835 460,177 287,328 681,916 246,471 1,919,935 567,625 171,326 ±1.7% 2.176x slower (rust-soft) 4.755x slower (rust)
  • Node has no portable column: node is OpenSSL's libcrypto with its assembly, and Node has no switch that turns it off

X.509 certificates (bench/crypto/x509)

Kernel Size Unit Nish Nish portable OpenSSL OpenSSL portable Go Go purego Rust Rust soft Node Band Nish / best portable Nish / best assembly
x509-mint 16 B op/s 8,184 8,081 5,646 5,607 9,248 4,274 29,259 — — ±2.0% 0.694x faster (openssl-portable) 3.575x slower (rust)
x509-parse 338 B op/s 2,760 2,602 6,391 6,520 14,705 6,286 8,813 — 7,350 ±1.3% 2.506x slower (openssl-portable) 5.327x slower (go)
  • Rust has no portable column: RustCrypto's p256, rcgen and x509-parser are pure Rust, so there is no curve assembly to switch off
  • Node has no x509-mint: node 's X509Certificate reads certificates and cannot write one
  • Node has no portable column: node is OpenSSL's libcrypto with its assembly, and Node has no switch that turns it off