# Benchmarks

House numbers with their hardware, each labeled a measurement or a CI budget — proxy overhead, binary size, and hot-path costs.

Source: https://tokentriage.com/docs/reference/benchmarks

---
import Callout from '../../../components/Callout.astro';

Every figure here is a number the product's own measurements produced — from
`docs/BENCHMARKS.md`, and (for the binary/image size) the `Dockerfile` header. Nothing is
extrapolated or invented. Each row is a **measurement** (a run's number) or a **CI budget**
(a gate that fails the build if crossed).

<Callout type="warning">
These are **house numbers on one box, largely loopback micro-benchmarks** — a floor for
TokenTriage's own overhead, not a wall-clock latency promise (real provider latency
dominates in production). Perf gates skip under `-race` and run in dedicated no-race jobs.
</Callout>

**Measurement environment (DW5-03 / recent waves):** Intel Core Ultra 9 285K, Go 1.25.x,
`windows/amd64`, `GOMAXPROCS=4`, loopback `httptest`, `CGO_ENABLED=0` (pure-Go SQLite).

## Proxy overhead

A two-arm, in-process, loopback benchmark: a request to a mock upstream directly vs. through
the proxy. The delta is proxy overhead, dominated by the extra loopback network hop.

| Arm | Value | Type |
|---|---|---|
| Direct to mock | ~45,900 ns/op | measurement |
| Through proxy (dashboard off) | ~111,100 ns/op | measurement |
| Through proxy + dashboard under load | ~146,500 ns/op | measurement |
| **Proxy overhead vs. direct** | **~65,200 ns (~0.065 ms)** | measurement |
| Dashboard-on delta | ~35,300 ns (~0.035 ms) | measurement |
| Overhead budget | **< 2 ms p99** non-streaming | CI budget |

## Size & portability

| Metric | Value | Type |
|---|---|---|
| Static binary (linux/amd64, `-s -w`, CGO-free) | ≈10.7 MB | measurement |
| Container image (`FROM scratch`) | ≈11 MB per arch | estimated |
| Platforms | linux/amd64, windows/amd64, darwin/arm64 | spec |

## Query, rebuild & bundle budgets

| Metric | Value | Budget | Type |
|---|---|---|---|
| Top-agent group-by (index, p95) | 86.1 ms | < 500 ms | measurement + budget |
| Time-series group-by (index, p95) | 45.4 ms | < 500 ms | measurement + budget |
| Drawer single-record PK fetch (p95) | 16.4 µs | < 50 ms | measurement + budget |
| Cost-by-team-by-month (from rollup cells, p95) | 23.5 ms | — (vs 69.3 ms from raw rows) | measurement |
| Full index rebuild (real 5,000,000 rows) | 4m 9.5s | < 10 min | measurement + budget |
| Dashboard initial JS + CSS (gzipped) | 293.9 KB | < 350 KB | measurement + budget |

## Hot-path budgets

| Path | Value | Budget | Type |
|---|---|---|---|
| Signal stage per score | ~6.7 µs | sub-millisecond | measurement + budget |
| `DecidePlan` (legacy ~50 rules) | ~5.3 µs | ≤ 100 µs (mean, p99 proxy) | measurement + budget |
| Governance admission (StageA + StageB, mean) | ~5.0 µs | ≤ 10 µs | measurement + budget |
| Cache lookup — L1 (memory) | ~251 ns | ≤ 5 µs p99 | measurement + budget |
| Cache lookup — L2 (SQLite, pure-Go) | ~13.8 µs | ≤ 300 µs p99 | measurement + budget |

<Callout type="note">
A few budgets are dual-status in the source and worth reading in full there: some
gates assert the benchmark *mean* as a p99 proxy (Windows timer quantization makes a
per-op wall-clock percentile noise); the governance StageB p99 sits right at its 5 µs
ceiling; and one scoped-evidence cache-hit budget is a known open item. `docs/BENCHMARKS.md`
is the complete, caveated record.
</Callout>

The honesty-verdict methodology (`report`/`eval`) is documented there too; see
[Routing](/docs/build/routing#the-honesty-verdict).
