Skip to content

Benchmarks

All benchmarks run on Apple M-series, PostgreSQL 18, Python 3.14t (free-threaded), Zig ReleaseFast. Methodology: wrk -t4 -c20 -d8s, 3 runs, median selected, jitter reported.

REST API Throughput (Bookstore API)

Endpoint rps p50 p99 Jitter
GET /health (no DB) 19,890 0.98ms 2.79ms 1.1%
GET /api/v1/books/stats (aggregate) 11,420 1.73ms 12.21ms 7.6%
GET /api/v1/reviews/ (cursor pagination) 7,500 2.51ms 6.58ms 0.7%
GET /api/v1/books/1 (detail + select_related) 6,349 2.85ms 14.19ms 1.1%
GET /api/v1/books/ (list + serializer) 5,337 3.37ms 20.92ms 7.7%
GET /api/v1/books/?search=python (FTS) 4,340 4.14ms 15.99ms 0.4%

Template Rendering (HyperNews)

Endpoint rps p50 p99
GET /login (template-only) 40,459 0.38ms 2.38ms
GET /forums (directory) 40,328 0.35ms 2.67ms
GET / (cached homepage) 40,000+ 0.36ms 3.35ms
GET /user/alice (multi-query) 40,608 0.35ms 5.38ms

Database (pg.zig vs psycopg3)

Operation pg.zig psycopg3 Speedup
SELECT by PK 21K ops/s 10K ops/s 2.06x
SELECT range 4.18x
UPDATE 1.52x
COPY bulk import 536K rows/s 12K rows/s 42.8x

Guard System Overhead

Guard Type Overhead
Single guard (Require.role) 0.21 us
3-guard chain 0.40 us
GuardSpec creation 0.85 us

JSON (SIMD Zig vs Python stdlib)

Operation Native stdlib Speedup
json_loads (tiny object) 94ns 576ns 6.1x
json_loads (integer) 48ns 467ns 9.8x
json_loads (float) 80ns 518ns 6.5x
json_loads (boolean) 49ns 441ns 9.0x
json_dumps (dict) 196ns

String Operations (SIMD Zig vs Python stdlib)

Operation Native stdlib Speedup
html_escape (with chars) 111ns 376ns 3.4x
url_encode (long path) 113ns 1390ns 12.3x
url_decode (percent) 88ns 1505ns 17.1x
parse_query_string (10p) 1574ns 5596ns 3.6x

Validation (Native Zig)

Operation Throughput
Model creation (init_model_full) 1.6M/sec
Per-field validation 6.7M fields/sec
Batch int validation (SIMD) 51.5M ints/sec
Batch model validation 13.1M models/sec
SIMD email validation 63ns/email

Template Compilation

Operation Native Jinja2 Speedup
Compile 7.1us 1.66ms 234x
Render (cached) 36us 61us 1.7x

WhereNode Compile (Zig vs Python)

Scenario Python Zig Speedup
Simple leaf 442ns 169ns 2.6x
3-filter AND 1737ns 464ns 3.7x
Complex nested (4 children) 3364ns 868ns 3.9x

Native Metric Primitives

Operation Latency Target
counter_inc 78ns 50ns
gauge_set 76ns 50ns
histogram_observe 81ns 100ns
counter_vec_inc 132ns 250ns
histogram_vec_observe 124ns 300ns

Reproduce

uv run hyper-build --release
uv run python scripts/bench_bookstore_wrk.py
uv run python scripts/bench_hypernews_wrk.py
uv run python scripts/bench_guard_overhead.py

Results saved to logs/bench_*.json and logs/bench_*.txt.