work / polyglot-bench

Polyglot Checkout Bench

One database-bound checkout transaction built ten ways in TypeScript, Go and Rust, proved identical, then measured with statistics.

Years
2026
Status
research
Source
hallelx2/polyglot-bench

What it is

Ten implementations of the same pricing and checkout API: six reads, a discount engine with stacking rules and coupons, and an eleven-statement write transaction. Three are TypeScript (Bun with Hono, plain Bun, Node with Fastify), four are Go and three are Rust.

Read more

No stack is timed until the conformance suite proves its responses byte-identical to the others. Then each runs five repetitions of ten seconds after a three-second warm-up, in shuffled order, with the database restored to seed before every run and a machine-speed probe each time.

450 runs, 6.0 million calls, zero non-2xx. At a fixed 300 requests a second every stack's p99 sits between 2.64 ms and 3.60 ms. Saturated, quote throughput spreads from 3,919 to 1,385 requests a second. The write-up is a paper with critical-difference plots, and a dashboard replays the per-second series.

Stack

  • TypeScript
  • Bun
  • Hono
  • Node
  • Fastify
  • Go
  • Gin
  • Fiber
  • Rust
  • axum
  • actix
  • hyper
  • PostgreSQL
  • Docker
  • Python
  • LaTeX

Counted

  • 450runs
    RESULTS.md
  • 6.0MAPI calls
    RESULTS.md, 0 non-2xx
  • 2.64–3.60 msp99 spread at 300 rps
    go-nethttp → ts-bun-hono
  • 3,919–1,385 rpssaturated quote throughput
    rust-axum → ts-node-fastify

How it works

The system as a machine on a bench. Hover or use the arrow keys to drive it.

Needle: quote p99 at 300 req/s, or req/s when saturatedLamp: the lane matched the gaugeTen carriages, one per stackTen implementations of one checkout API on one bed: a gauge proves every lane byte-identical before anything is timed, then each run restores the database to seed and loads one lane, in shuffled order. At a fixed 300 req/s the p99 needles bunch between 2.64 and 3.60 ms; saturated, they spread from 1,385 to 3,919 req/s.

The path through it

  1. One specThe API, the discount rules and the transaction, written once in spec/.
  2. Ten servicesEach stack implements the spec in services/.
  3. ConformanceEvery response compared; 10 of 10 identical before any timing.
  4. Load5 × 10 s per stack after a 3 s warm-up, shuffled order, DB restored to seed every run.
  5. AnalysisCoefficient of variation, significance contrasts, critical-difference plots, the paper and the dashboard.