本页还没有译文
本页 39 段还没译成简体中文,下面显示的是英文原文。Benchmarks
还没翻译译自英文(hono.dev)本页 39 段都还没译
模型写的
背景主张方法设置结果
Routers
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.测量了多种 JavaScript 路由的速度,包括 find-my-way Fastify 内使用的极快路由器 find-my-way 设定了对比基准测量了多种 JavaScript 路由的速度,包括 find-my-way路由速度
- @medley/router@medley/router@medley/router@medley/router@medley/router
- find-my-wayfind-my-wayfind-my-wayfind-my-wayfind-my-way
- koa-tree-routerkoa-tree-routerkoa-tree-routerkoa-tree-routerkoa-tree-router
- trek-routertrek-routertrek-routertrek-routertrek-router
- express (includes handling)express (includes handling)express(包含处理)express(包含处理)express
- koa-routerkoa-routerkoa-routerkoa-routerkoa-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.每个路由器都注册了十二条接近真实的路径 使用贴近真实的路径模式使基准测试更接近生产环境每个路由器都注册了十二条接近真实的路径注册路由
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.向七种端点类型发送请求,包括通配符和 post 短静态、动态和通配符各自考验不同的路由路径向七种端点类型发送请求,包括通配符和 post请求端点
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.让我们看看结果让我们看看结果让我们看看结果
Cloudflare Workers
Hono 达到每秒 402,820 次操作,是 Cloudflare Workers 路由器中最快的
Hono is the fastest, compared to other routers for Cloudflare Workers.Hono is the fastest, compared to other routers for Cloudflare Workers.Hono 是 Cloudflare Workers 上最快的路由器 在该平台上它与其他路由器而非框架进行比较Hono 是 Cloudflare Workers 上最快的路由器Workers 最快
- Machine: Apple MacBook Pro, 32 GiB, M1 ProMachine: Apple MacBook Pro, 32 GiB, M1 Pro机器:Apple MacBook Pro,32 GiB,M1 Pro机器:Apple MacBook Pro,32 GiB,M1 Pro机器
- Scripts: benchmarks/handle-eventScripts: benchmarks/handle-event脚本:benchmarks/handle-event脚本:benchmarks/handle-event脚本
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 每秒处理 136112 个请求,是 Deno 框架中最快的
Hono is the fastest, compared to other frameworks for Deno.Hono is the fastest, compared to other frameworks for Deno.Hono 是 Deno 上最快的框架 它在此与其他 Deno 框架而非路由器比较Hono 是 Deno 上最快的框架Deno 最快
- Machine: Apple MacBook Pro, 32 GiB, M1 Pro, Deno v1.22.0Machine: Apple MacBook Pro, 32 GiB, M1 Pro, Deno v1.22.0机器:Apple MacBook Pro,32 GiB,M1 Pro,Deno v1.22.0机器:Apple MacBook Pro,32 GiB,M1 Pro,Deno v1.22.0机器
- Scripts: benchmarks/denoScripts: benchmarks/deno脚本:benchmarks/deno脚本:benchmarks/deno脚本
- 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 使用 bombardier 达到每秒 136112 个请求 在同一压测命令下它超过了 Fast、Megalo、Faster、oak 和 opineHono 3.0.0 使用 bombardier 达到每秒 136112 个请求每秒请求
| Framework | Version | Results |
|---|---|---|
| Hono | 3.0.0 | Requests/sec: 136112 |
| Fast | 4.0.0-beta.1 | Requests/sec: 103214 |
| Megalo | 0.3.0 | Requests/sec: 64597 |
| Faster | 5.7 | Requests/sec: 54801 |
| oak | 10.5.1 | Requests/sec: 43326 |
| opine | 2.2.0 | Requests/sec: 30700 |
Another benchmark result: denosaurs/benchAnother benchmark result: denosaurs/bench另一份基准结果:denosaurs/bench另一份基准结果:denosaurs/bench其他基准
Bun
Hono 是 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 是 Bun 上最快的框架之一 这一说法比 Deno 更温和,只把 Hono 列为领先者而非第一Hono 是 Bun 上最快的框架之一Bun 最快
- SaltyAom/bun-http-framework-benchmarkSaltyAom/bun-http-framework-benchmarkSaltyAom/bun-http-framework-benchmarkBun 基准















