vortex

09 — Phase 3 benchmarks

@avarok/vortex 0.1.0 · Updated

Branch phase-3-bench. Harness: bench/ (cell, run, report, impls, mini/). Raw data: bench/results/bench-results-t{4,8}.jsonl, one line per cell with the Node version, CPU and 1-min load before and after.

Method

Results (median of 5, min–max in brackets)

Throughput is in tasks/s. Latency is a sequential round trip.

workload threads vortex piscina tinypool workerpool mini-wasm-push mini-wasm-pull mini-js-push
echo 4 121k (121–124k) 130k (127–134k) 205k (202–211k) 181k (178–184k) 1.62M (1.60–1.64M) 1.70M (1.69–1.76M) 1.74M (1.64–1.84M)
echo 8 99k (98–99k) 106k (105–109k) 178k (177–179k) 164k (164–166k) 1.42M (1.41–1.42M) 1.11M (1.11–1.12M) 1.79M (1.76–1.82M)
obj 4 107k (106–109k) 122k (120–124k) 204k (196–205k) 176k (170–178k) — — —
obj 8 90k (90–91k) 104k (99–106k) 177k (176–177k) 156k (155–158k) — — —
spin50 4 50.3k 55.6k 56.7k 55.7k 53.7k 77.4k 53.6k
spin50 8 67.6k 83.6k 98.6k 90.3k 90.0k 154.0k 90.8k
latency p50/p99 µs 4 18.3 / 36.6 11.7 / 19.7 10.3 / 16.7 9.5 / 16.9 14.6 / 27.3 17.3 / 30.8 14.5 / 27.0
latency p50/p99 µs 8 18.7 / 41.2 13.7 / 23.9 10.5 / 17.5 9.5 / 17.6 14.6 / 27.2 22.8 / 56.6 14.6 / 24.3

spin50's ideal is threads / 50 µs, which is 80k (4 threads) and 160k (8 threads). obj returns an object, which the ablation pools cannot carry.

What this proves (on this machine, these workloads, Node 22)

  1. vortex as shipped is not fast. It is the slowest of the four full pools in every cell: below piscina by 7–19% on throughput, and its p50 latency is about 1.6× piscina's and about 1.9× workerpool's. tinypool leads throughput and workerpool leads latency.
  2. The cost is in the JS shim, not the core. The same core under a minimal engine runs echo 13–14× faster than vortex. Profile of the vortex echo cell:
    • Main thread: 16% self time in the per-dispatch get interface object (inherited from piscina's balancer contract), plus microtask and resource overhead.
    • Worker: two-thirds of samples are performance.now calls made from the wasm idle spin through the vortex_now_us import.
  3. Rust/wasm contributes nothing measurable here. mini-js-push is equal to or faster than mini-wasm-push in every cell (echo at 8 threads: 1.79M vs 1.42M). Both carry the same algorithms, so the difference is the JS↔wasm call boundary and imports.
  4. Push vs pull:
    • Pull with prefetch wins CPU-bound throughput clearly. It is near ideal: 77k of 80k and 154k of 160k, against about 54k and 90k for push.
    • Push wins latency (14.6 vs 17.3–22.8 µs p50) and empty-task throughput at 8 threads.
    • The push engine places one task per idle worker, so a worker idles for one round trip between tasks. That is a property of push without per-worker depth.
  5. Futex wake vs port message: even the minimal shared-memory engine's single round trip (14.6 µs) is slower than workerpool's and tinypool's port round trip (9.5–10.5 µs), so the waitAsync + wait32 wake path does not beat MessagePort for isolated tasks.

What this does not prove

Consequences for the plan (for the coordinator to decide)

Fix series (after the coordinator's go)

Each fix was measured on its own: every step's dist/ was snapshotted (steps/<label>/, run as vortex@<label>) and interleaved with the step before it and with piscina inside the same gated repetitions, because load on the bench machine drifts between runs. Same machine, Node v22.23.3, same gate, 5 repetitions, medians.

Step Change echo 4t echo 8t obj 4t spin50 4t spin50 8t p50 µs 4t p99 µs 4t
s0 → s1 balancer view built once per worker 120k → 166k 99k → 127k 106k → 137k 50.5k → 52.2k 67.6k → 86.8k 17.7 → 16.8 37.4 → 34.4
s1 → s2 clock read every 64 spin iterations 166k → 163k 127k → 127k 137k → 139k 52.2k → 52.1k 86.8k → 88.8k 16.8 → 16.0 34.4 → 30.6
s2 → s3 push prefetch 164k → 252k (load spike) 137k → 196k 52.5k → 76.2k (load spike) 16.0 → 16.0 31.1 → 31.3
s3 → s4 per-task path trimmed 255k → 297k 166k → 187k 201k → 230k 75.4k → 76.6k 126k → 139k 16.0 → 17.1 39.7 → 31.0
s4 → s5 hybrid completion wake 300k → 404k 187k → 256k 231k → 290k 76.6k → 76.2k 143k → 144k 16.3 → 6.4 30.6 → 29.8

The s2 → s3 8-thread cells ran during a load spike (up to 14.9, one cell discarded, piscina itself fell about 30 %). The final run below measures s3's effect inside s0 → s5.

Before and after (one run, all implementations interleaved)

Raw: bench/results/final-t{4,8}.jsonl. Load 2.6–4.5, no cell discarded.

workload thr vortex before (s0) vortex after (s5) piscina tinypool workerpool mini push mini pull mini JS push mini push + port completion
echo 4 122k 397k 130k 211k 182k 1.60M 1.66M 1.70M 1.53M
echo 8 99k 259k 106k 182k 165k 1.38M 1.10M 1.82M 1.29M
obj 4 107k 289k 122k 209k 176k — — — —
obj 8 90k 208k 105k 179k 157k — — — —
spin50 (ideal 80k) 4 50.2k 76.4k 55.6k 56.6k 55.7k 52.9k 77.6k 53.3k 62.5k
spin50 (ideal 160k) 8 68.1k 144.1k 83.2k 98.7k 90.1k 90.2k 154.2k 91.0k 108.2k
latency p50 / p99 µs 4 17.4 / 37.0 6.5 / 30.0 11.8 / 19.6 10.4 / 16.8 9.6 / 17.1 14.6 / 26.3 17.3 / 27.4 14.6 / 26.5 3.3 / 7.0
latency p50 / p99 µs 8 18.7 / 42.5 6.9 / 29.0 13.7 / 24.2 10.5 / 17.1 9.5 / 17.8 14.6 / 26.5 23.7 / 49.5 14.6 / 26.5 3.4 / 7.9

What this shows, and what it does not

Two cores, step by step (owner decisions of 2026-11-27)

One gated run, all builds and pools interleaved in every repetition: Apple M4 Pro, Node.js v22.23.3, five repetitions, load 4.8–10.3 (gate 15), no cell discarded or failed. Raw data: bench/results/cores-t4.jsonl, cores-t8.jsonl. Medians; latency is p50 / p99 µs.

build (commit) change echo t4 echo t8 obj t4 obj t8 spin50 t4 spin50 t8 latency t4 latency t8
c0:js (3a57cf9) two cores, JS core 387k 255k 277k 200k 76.2k 142k 6.7 / 29.5 6.7 / 29.5
c0:rust (3a57cf9) two cores, Rust core 395k 262k 282k 204k 76.3k 144k 6.7 / 29.9 13.9 / 29.9
ca:rust (2411acb) 2a: idle path reads no clock 402k 290k 291k 209k 76.3k 143k 9.4 / 29.9 6.7 / 29.0
cc:rust (b78c85f) 2c: i32 hot path 402k 349k 287k 214k 76.2k 142k 10.9 / 28.7 6.5 / 29.2
cb:rust (45ecfcd) 2b: one release per drain 435k 304k 307k 233k 76.1k 142k 12.1 / 28.3 6.5 / 28.5
cd:rust (9a39534) spin calibration; main-wait fix 432k 238k 308k 193k 76.2k 141k 13.6 / 28.3 13.8 / 29.0
ce:rust (e90e5f4) main wakes on MSG_WAKE alone 686k 559k 428k 355k 74.7k 142k 4.4 / 10.7 4.5 / 12.1
ce:js (e90e5f4) the same, JS core 622k 274k 405k 227k 74.9k 143k 4.4 / 12.1 4.5 / 13.2
piscina 5.3.2 131k 107k 123k 102k 55.7k 80.9k 11.7 / 19.9 13.7 / 24.3

What this shows:

The gap between the cores, honestly: after these steps the Rust core is not behind the JS core on any cell. At 4 threads it is 10 % ahead on echo, 6 % on obj, level on spin50 and p50, 1.4 µs better at p99. At 8 threads it is 2.0× the JS core on echo and 1.6× on obj, and the JS core varied widely there (echo 270k–381k); why the JS core falls behind at 8 threads has not been investigated. The calls that remain per task on the Rust core: reserve, assign, next, finish_assigned and, with recordTiming, two histogram records.