docs: correct the observability cost, and record why three earlier numbers were wrong

The published figure was -3.9%. It was measured sequentially rather than
interleaved, and the machine drifts 12% across a session as it warms, so run
order was indistinguishable from effect. Two later attempts to correct it were
also wrong: 0.8% had the same flaw, and -6.8% compared 7bd11bf against HEAD,
which differ by observability *and* three performance fixes pulling the other
way, then reported their net as if it were one of them.

Measured properly, alternating round by round between 7bd11bf and 523e318 (the
last commit before those fixes): +7.0% of the framework's own per-request work,
about 0.29us, roughly 2% of a request over a real socket. Ranges do not overlap.

The guide no longer quotes absolute throughput from this laptop. The reference
numbers come from a two-box setup, and single-box loopback figures invite a
comparison that is not valid.

D7's shape survives: the cost is fixed per request, not per step, because
per-step work is skipped when nothing subscribes.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
chrnx committed 2026-08-16 23:03:07 -05:00
1 parent 8d8ef7ed09
commit 5fafe97bc5
3 files changed
+23 -15

No files matched your search

@@ -131,13 +131,15 @@ instrumentation — the graph already knows every node.
## What it costs
Measured, not asserted, on the box that produced [BENCHMARKS.md](https://github.com/Expressive-Tea/green-tea/blob/main/BENCHMARKS.md):
**About 0.29 µs per request** — roughly **7% of the framework's own work**, or **~2% of a request
measured over a real socket**, where the transport dominates.
| Scenario | Before | After | |
|---|---:|---:|---:|
| JSON hello | 78,118 req/s | 75,075 req/s | −3.9% |
| Pipeline (3 steps) | 70,671 req/s | 69,164 req/s | −2.1% |
The cost is **per request, not per step**. Per-step timing and payload construction are skipped
entirely when nothing is subscribed, so a deep pipeline pays no more than a shallow one. What
remains is fixed: generating the request id, reading two headers, and the checks that decide
whether anyone is listening.
The cost is **per request, not per step** — which is why the route with *fewer* steps loses more.
Most of it is generating the request id; per-step timing and payload construction are skipped
entirely when nothing is subscribed.
Absolute throughput numbers are deliberately not quoted here. The figure above comes from an
interleaved A/B — alternating both versions round by round — because the same code measured at the
start and end of one session on the same machine differed by 12% as it warmed up. Any before/after
that does not interleave is measuring the clock as much as the code.