Router benchmarks
The table below compares route-matching throughput at 50 registered routes, measured in microseconds per iteration (lower is better). Blaze’s TrieRouter sits between the two Hono routers in absolute speed while delivering better worst-case scaling than itty-router or Express.
The key insight is scaling behaviour, not just the 50-route snapshot. Express and itty-router use linear scans — each additional route adds cost to every request. Blaze’s trie depth grows logarithmically, so adding your 200th route barely moves the needle.
The v8 JIT compiles the trie on first warm-up. After a handful of requests in the same isolate, the hot path is fully compiled — subsequent requests pay zero route registration cost and benefit from optimised native code. The µs/iter figures above represent post-JIT steady-state performance.
Bundle size
A smaller bundle means a faster cold start. Blaze ships no npm dependencies — the trie router, middleware compose, and response helpers are all hand-rolled.
Blaze is ~21% smaller than Hono’s tiny preset and ~39% smaller than Hono’s default build at equivalent feature coverage.
Cold start tips
Cold starts happen when Cloudflare spins up a fresh isolate for your Worker. The v8 isolate has to parse and evaluate your module before it can handle the first request. Keep these rules in mind to stay fast:Background tasks with waitUntil
Usereq.ctx.waitUntil() for fire-and-forget work that should not delay your response — analytics writes, cache warming, logging to an external pipeline. The Worker runtime keeps the isolate alive until all waitUntil promises settle, but the Response is sent to the client immediately.
waitUntil patterns:
KV and D1 optimization tips
- KV
- D1
Isolate-level caching — KV reads are fast (~1 ms from Cloudflare’s edge), but if you read the same key on every request you can do better. Store hot values in a module-level Use typed
Map and refresh them with waitUntil in the background.get calls — pass { type: 'json' } instead of JSON.parse(await kv.get(...)) to let the KV client handle deserialization: