Performance
Numbers below were measured on 2026-10-24 on a single MacBook (Apple Silicon, 8 cores) with the API and PostgreSQL 15 on the same machine — a pessimistic setup (they compete for CPU). Re-run them with the commands shown; CI runs the benchmarks on every push as a smoke test.
Micro-benchmarks — make bench
| Hot path | Result | Allocations |
|---|---|---|
| Token verification (every authenticated request) | 2.5 µs/op | 17 allocs |
| Rate-limiter check, parallel | 52 ns/op | 1 alloc |
| UUIDv7 generation | 475 ns/op | 0 allocs |
| Publish one event to 1,000 live subscribers | 0.37 ms/op (≈ 370 ns per delivery) | 0 allocs |
Load tests — make load (cmd/biscuit-load, 64 concurrent clients, 8 s each)
| Scenario | Throughput | p50 | p95 | p99 | Errors |
|---|---|---|---|---|---|
read — GET /v1/bots (auth + query + gzip) |
13,500 req/s | 3.1 ms | 12.7 ms | 29.5 ms | 0 |
page — 50-message thread page (keyset index) |
8,560 req/s | 6.5 ms | 14.7 ms | 25.4 ms | 0 |
write — post message (2 transactions + NOTIFY + reply), unbounded |
2,560 req/s accepted | 23.5 ms | 37.7 ms | 50.6 ms | 0 |
The write result shows why back-pressure exists: the API accepted messages far faster than
the model could answer them (each reply streams for ~0.5 s and concurrency is capped at 32),
which left thousands of replies waiting. With the reply backlog bounded
(BISCUIT_REPLY_BACKLOG=512), the same flood behaves correctly:
write with bounded backlog |
Result |
|---|---|
| Accepted | 1,024 (exactly what model capacity allowed during the run) |
| Rejected | 104,595 as 503 busy + Retry-After, p50 11 ms — nothing stored, safe to retry |
| Process memory (RSS) after the flood | 175 MB |
| Goroutines | bounded (backlog + streams), no growth |
Sizing rule of thumb: one API process handles ~10k simple reads/s; model replies are
bounded by BISCUIT_LLM_CONCURRENCY and provider latency, not by the server. For more replies,
raise concurrency within your provider quota and add replicas.
Why it's fast
- No ORM, no reflection-heavy framework: hand-written SQL over pgx's binary protocol with the statement cache (one round trip per query).
- Indexes match queries exactly: every list query is an index range scan
(
workspace_id, …, id DESC) withLIMIT n+1to detect the next page — noCOUNT(*), noOFFSET. - UUIDv7 keys: inserts append to the right edge of the B-tree; no random-key page splits.
- Stateless auth: tokens verify in memory; no session table lookups.
- Pooled gzip writers at the fastest level (JSON shrinks ~60%, e.g. 1.6 KB → 0.6 KB).
- Non-blocking fan-out: buffered channels; slow consumers are dropped, not waited on.
- Bounded everything: request bodies, statement timeout (5 s), idle-in-transaction timeout,
model concurrency, reply backlog, rate limits, memory limit (
GOMEMLIMIT).
Frontend
Measured with npm run build && npm run budget (gzip sizes).
| Before | After | |
|---|---|---|
| First-load JavaScript | 342 KB | 258 KB (−25%) |
| First-load CSS | 37.7 KB | 36.7 KB |
| Lazy chunks | 1 | 18 (every page except home/chat, 3D view, doc & slide editors, ⌘K) |
| Vendor caching | one bundle; every deploy re-downloads React | separate long-lived vendor-react, vendor-motion, vendor-icons, vendor chunks |
| Retro fonts | always downloaded (render-blocking @import) |
only when that style is active |
Lazy routes are prefetched with requestIdleCallback after first paint, so navigation stays
instant. CI fails if first-load JS exceeds 275 KB or CSS 45 KB gzip. The JS budget was 240 KB
until v0.23.0; React 19, React Router 7 and Framer Motion 14 added about 47 KB to the first load.
v0.22.0: startup, caching and scale
| Before | After | |
|---|---|---|
| First-load JS (gzip) | 275.6 KB | 222 KB (−20%) |
| First-load JS (minified) | 1,297 KB | 707 KB (−45%) |
| Bot sprite data | 491 KB (each expression repeated its shared layers) | 37 KB, identical output |
| Lazy on first use | — | modals, Pac-Man chomp + GSAP, charts, diagrams |
| Repeat visit, hashed assets | revalidated every load (max-age=0) |
cached a year, immutable; served by the service worker |
| Offline | blank page | app shell + cached assets load offline |
| API reads | every read hits the network | deduped, 15 s fresh, then ETag revalidation (304 reuses the body) |
| Long chats | every message rendered and laid out | latest 60 rendered; off-screen messages skip layout/paint |