Benchmarks
Measured 2026-10-15 on Bun 1.4.2, Linux, a shared CPU. Absolute times move by about ±20% between runs and machines: compare ratios and orders of magnitude, not single digits.
Every page is generated by bun scripts/bench-docs.ts (after bun run build) and every table says which command reproduces it. The harnesses live in benchmarks/ and scripts/, outside the published packages.
| Classification | What it measures | Page |
|---|---|---|
| Collection | Reads, writes, scans and eviction, against a plain Map |
Collection |
| Builders | Building and serialising embeds, components and commands | Builders |
| Formatters | Mentions, timestamps and text styling helpers | Formatters |
| Gateway events | The cost of each dispatch the client handles, cache sync included | Gateway events |
| REST | Request scheduling against a fake Discord with real rate-limit windows | REST |
| Cache memory | Heap kept per guild for small, medium and large guilds | Cache memory |
Reading the numbers
Section titled “Reading the numbers”- Times are per call, after a warm-up, as the median of 3 runs.
- Regressions.
bun run bench:comparere-runs the runtime benchmark, scales it by how fast this machine runs a plainMapcompared with the committed baseline (docs/perf/), and warns on anything more than 15% slower. It runs in CI and only warns. - Why a fake Discord? Network benchmarks depend on Discord’s availability, so REST and Gateway figures use controlled fakes.