Validation & parsing
Parse incoming strings, validate shape and types, return typed output. Schema validation, JWT revalidation, Salt hashing, Prompt token budgeting.
These examples use real payload-carrying workloads on purpose. Primitive-only tasks are often near-instant, which hides coordination and transfer costs. Payload transforms are closer to production traffic, so the host-vs-worker comparisons are more honest.
Treat the benchmark blocks in this section as supporting material, not the main event. Most pages are now organized around the runnable example first, with a benchmark command attached if you want to measure the same pattern on your machine. If you want one page that keeps the full performance discussion, start with Hono server routes.
If you’re validating incoming data — API payloads, form submissions, webhook bodies — start with Schema validation. It’s the simplest validation pattern and uses Zod, which you’re probably already familiar with.
If you’re doing auth work — token verification, renewal, signature checking — JWT revalidation shows how to offload HMAC crypto to workers using built-in Web Crypto (no external JWT library).
If you’re hashing passwords — Salt hashing is the heaviest per-call example. PBKDF2 is intentionally slow, making it the ideal candidate for offloading.
If you’re calling an LLM — Prompt token budgeting trims prompts to fit a token budget. The budgeting itself is model-agnostic.
If you’re rendering HTML — React SSR for basic server rendering, React SSR compression to also test Brotli placement, or Markdown to HTML for a simpler pipeline without React.
If you handle file uploads — Image processing API offloads resize, thumbnail, and watermark operations to workers using sharp. It’s the binary payload counterpart to the Hono SSR example.
If you want the full picture — Hono server routes is a real HTTP server that combines SSR, JWT, and health checks. It’s the closest to a production setup.
Validation & parsing
Parse incoming strings, validate shape and types, return typed output. Schema validation, JWT revalidation, Salt hashing, Prompt token budgeting.
Rendering & output
Take validated input and produce final output formats. Hono server routes, Image processing API, React SSR, React SSR compression, Markdown to HTML.