Skip to main content
Blaze is optimized for Cloudflare’s v8 isolate model. Route registration is synchronous at module startup — the trie is built once when your Worker’s isolate initializes, then amortized over every subsequent request served by that isolate. You pay the registration cost exactly once per datacenter warm-up, and matching is O(log n) for the lifetime of the isolate.

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

Use req.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.
Common waitUntil patterns:

KV and D1 optimization tips

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 Map and refresh them with waitUntil in the background.
Use typed get calls — pass { type: 'json' } instead of JSON.parse(await kv.get(...)) to let the KV client handle deserialization:
Apply the compress() middleware only to routes that return text responses larger than approximately 1 KB. Compressing small JSON payloads (a few hundred bytes) costs more CPU than it saves in bytes — the overhead of Brotli/gzip encoding exceeds the transfer benefit. Scope it to specific routes or check Content-Length before compressing: