Skip to main content

Benchmarks

Model-written

contextclaimmethodsetupresult

Benchmarks

Benchmarks matter to Hono even though they are only benchmarks

Benchmarks are only benchmarks, but they are important to us.Benchmarks are only benchmarks, but they are important to us.Benchmarks are only benchmarks, but Hono values them The page treats benchmark numbers as meaningful signals despite their limitsBenchmarks are only benchmarks, but Hono values themBenchmarks

Routers

Router speeds were measured across eight JavaScript routers with real-world routes

We measured the speeds of a bunch of JavaScript routers. For example, find-my-way is a very fast router used inside Fastify.We measured the speeds of a bunch of JavaScript routers. For example, find-my-way is a very fast router used inside Fastify.Speeds of many JavaScript routers were measured, including find-my-way find-my-way, a very fast router inside Fastify, sets the comparison barSpeeds of many JavaScript routers were measured, including find-my-wayRouter speeds

  • @medley/router
    @medley/router
    @medley/router
    @medley/router
    @medley/router
  • find-my-way
    find-my-way
    find-my-way
    find-my-way
    find-my-way
  • koa-tree-router
    koa-tree-router
    koa-tree-router
    koa-tree-router
    koa-tree-router
  • trek-router
    trek-router
    trek-router
    trek-router
    trek-router
  • express (includes handling)
    express (includes handling)
    express (includes handling)
    express (includes handling)
    express
  • koa-router
    koa-router
    koa-router
    koa-router
    koa-router

First, we registered the following routing to each of our routers. These are similar to those used in the real world.First, we registered the following routing to each of our routers. These are similar to those used in the real world.Twelve real-world-like routes were registered on every router Using realistic route patterns keeps the benchmark comparable to production useTwelve real-world-like routes were registered on every routerRegistered routes

export const routes: Route[] = [
  { method: 'GET', path: '/user' },
  { method: 'GET', path: '/user/comments' },
  { method: 'GET', path: '/user/avatar' },
  { method: 'GET', path: '/user/lookup/username/:username' },
  { method: 'GET', path: '/user/lookup/email/:address' },
  { method: 'GET', path: '/event/:id' },
  { method: 'GET', path: '/event/:id/comments' },
  { method: 'POST', path: '/event/:id/comment' },
  { method: 'GET', path: '/map/:location/events' },
  { method: 'GET', path: '/status' },
  { method: 'GET', path: '/very/deeply/nested/route/hello/there' },
  { method: 'GET', path: '/static/*' },
]

Then we sent the Request to the endpoints like below.Then we sent the Request to the endpoints like below.Requests were sent to seven endpoint types including wildcard and post Short static, dynamic and wildcard cases each stress a different routing pathRequests were sent to seven endpoint types including wildcard and postRequest endpoints

const routes: (Route & { name: string })[] = [
  {
    name: 'short static',
    method: 'GET',
    path: '/user',
  },
  {
    name: 'static with same radix',
    method: 'GET',
    path: '/user/comments',
  },
  {
    name: 'dynamic route',
    method: 'GET',
    path: '/user/lookup/username/hey',
  },
  {
    name: 'mixed static dynamic',
    method: 'GET',
    path: '/event/abcd1234/comments',
  },
  {
    name: 'post',
    method: 'POST',
    path: '/event/abcd1234/comment',
  },
  {
    name: 'long static',
    method: 'GET',
    path: '/very/deeply/nested/route/hello/there',
  },
  {
    name: 'wildcard',
    method: 'GET',
    path: '/static/index.html',
  },
]

Let's see the results.Let's see the results.Let's see the resultsLet's see the resultsLet's see the results

On Node.js

Screenshots present the Node.js router benchmark results

The following screenshots show the results on Node.js.The following screenshots show the results on Node.js.Screenshots show the router benchmark results on Node.js The per-request-type images are the only published numbers for this platformScreenshots show the router benchmark results on Node.jsNode.js results

On Bun

Screenshots present the Bun router benchmark results

The following screenshots show the results on Bun.The following screenshots show the results on Bun.Screenshots show the router benchmark results on Bun Bun runs the same route benchmark separately from Node.jsScreenshots show the router benchmark results on BunBun results

Cloudflare Workers

Hono reaches 402,820 ops/sec, fastest among Cloudflare Workers routers

Hono is the fastest, compared to other routers for Cloudflare Workers.Hono is the fastest, compared to other routers for Cloudflare Workers.Hono is the fastest router for Cloudflare Workers It is compared against other routers rather than frameworks on this platformHono is the fastest router for Cloudflare WorkersFastest on Workers

  • Machine: Apple MacBook Pro, 32 GiB, M1 Pro
    Machine: Apple MacBook Pro, 32 GiB, M1 Pro
    Machine: Apple MacBook Pro, 32 GiB, M1 Pro
    Machine: Apple MacBook Pro, 32 GiB, M1 Pro
    Machine
  • Scripts: benchmarks/handle-event
    Scripts: benchmarks/handle-event
    Scripts: benchmarks/handle-event
    Scripts
Hono x 402,820 ops/sec ±4.78% (80 runs sampled)
itty-router x 212,598 ops/sec ±3.11% (87 runs sampled)
sunder x 297,036 ops/sec ±4.76% (77 runs sampled)
worktop x 197,345 ops/sec ±2.40% (88 runs sampled)
Fastest is Hono
✨  Done in 28.06s.

Deno

Hono serves 136112 requests/sec, fastest among Deno frameworks

Hono is the fastest, compared to other frameworks for Deno.Hono is the fastest, compared to other frameworks for Deno.Hono is the fastest framework for Deno It is measured against other Deno frameworks, not routersHono is the fastest framework for DenoFastest on Deno

  • Machine: Apple MacBook Pro, 32 GiB, M1 Pro, Deno v1.22.0
    Machine: Apple MacBook Pro, 32 GiB, M1 Pro, Deno v1.22.0
    Machine: Apple MacBook Pro, 32 GiB, M1 Pro, Deno v1.22.0
    Machine: Apple MacBook Pro, 32 GiB, M1 Pro, Deno v1.22.0
    Machine
  • Scripts: benchmarks/deno
    Scripts: benchmarks/deno
    Scripts: benchmarks/deno
    Scripts
  • Method: bombardier --fasthttp -d 10s -c 100 'http://localhost:8000/user/lookup/username/foo'
    Method: bombardier --fasthttp -d 10s -c 100 'http://localhost:8000/user/lookup/username/foo'
    Hono 3.0.0 reaches 136112 requests/sec with bombardier It beats Fast, Megalo, Faster, oak and opine under the same load command
    Hono 3.0.0 reaches 136112 requests/sec with bombardier
    Requests per second
FrameworkVersionResults
Hono3.0.0Requests/sec: 136112
Fast4.0.0-beta.1Requests/sec: 103214
Megalo0.3.0Requests/sec: 64597
Faster5.7Requests/sec: 54801
oak10.5.1Requests/sec: 43326
opine2.2.0Requests/sec: 30700

Another benchmark result: denosaurs/benchAnother benchmark result: denosaurs/benchAnother benchmark result: denosaurs/benchAnother benchmark result: denosaurs/benchOther benchmark

Bun

Hono ranks among the fastest frameworks for Bun

Hono is one of the fastest frameworks for Bun. You can see it below.Hono is one of the fastest frameworks for Bun. You can see it below.Hono is one of the fastest frameworks for Bun The claim is softer than for Deno, ranking Hono among leaders rather than firstHono is one of the fastest frameworks for BunFastest on Bun