Skip to content

Commit

Permalink
chore: benchmark to mitata
Browse files Browse the repository at this point in the history
  • Loading branch information
edamsecx committed Dec 26, 2024
1 parent b1335f9 commit 556c1a1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 36 deletions.
24 changes: 9 additions & 15 deletions benchmarks/handle-event/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Benchmark from 'benchmark'
import { bench, group, run } from 'mitata'
import { makeEdgeEnv } from 'edge-mock'
import { Router as IttyRouter } from 'itty-router'
import { Request, Response } from 'node-fetch'
Expand Down Expand Up @@ -125,25 +125,19 @@ const fn = async () => {
}
fn()

const suite = new Benchmark.Suite()

suite
.add('Hono', async () => {
group(() => {
bench('Hono', async () => {
await hono.fetch(event.request)
})
.add('itty-router', async () => {
bench('itty-router', async () => {
await ittyRouter.handle(event.request)
})
.add('sunder', async () => {
bench('sunder', async () => {
await sunderApp.handle(event)
})
.add('worktop', async () => {
bench('worktop', async () => {
await worktopRouter.run(event)
})
.on('cycle', (event) => {
console.log(String(event.target))
})
.on('complete', function () {
console.log(`Fastest is ${this.filter('fastest').map('name')}`)
})
.run({ async: true })
})

run()
6 changes: 3 additions & 3 deletions benchmarks/handle-event/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
"author": "Yusuke Wada <[email protected]> (https://github.com/yusukebe)",
"license": "MIT",
"devDependencies": {
"benchmark": "^2.1.4",
"edge-mock": "^0.0.15",
"itty-router": "^3.0.11",
"node-fetch": "^3.2.10",
"sunder": "^0.10.1",
"worktop": "^0.7.3"
"worktop": "^0.7.3",
"mitata": "^1.0.23"
}
}
}
23 changes: 5 additions & 18 deletions benchmarks/handle-event/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ [email protected]:
resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2"
integrity sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==

benchmark@^2.1.4:
version "2.1.4"
resolved "https://registry.yarnpkg.com/benchmark/-/benchmark-2.1.4.tgz#09f3de31c916425d498cc2ee565a0ebf3c2a5629"
integrity sha512-l9MlfN4M1K/H2fbhfMy3B7vJd6AGKJVQn2h6Sg/Yx+KckoUA7ewS5Vv6TjSq18ooE1kS9hhAlQRH3AkXIh/aOQ==
dependencies:
lodash "^4.17.4"
platform "^1.3.3"

binary-extensions@^2.0.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d"
Expand Down Expand Up @@ -365,11 +357,6 @@ livereload@^0.9.3:
opts ">= 1.2.0"
ws "^7.4.3"

lodash@^4.17.4:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==

[email protected]:
version "0.3.0"
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
Expand Down Expand Up @@ -402,6 +389,11 @@ [email protected]:
resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"
integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==

mitata@^1.0.23:
version "1.0.23"
resolved "https://registry.yarnpkg.com/mitata/-/mitata-1.0.23.tgz#aa2f9ec90c66b74ed3329889918bbe0ee0336d9f"
integrity sha512-G2t4HG01WGOceXNSq72IARFURXQh/9lNDdnxIfGHGHO31LTrpHuzRrZwoRqMgvgnF4uo0Cjo6SNMP8XGSbttCg==

[email protected]:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
Expand Down Expand Up @@ -480,11 +472,6 @@ picomatch@^2.0.4, picomatch@^2.2.1:
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==

platform@^1.3.3:
version "1.3.6"
resolved "https://registry.yarnpkg.com/platform/-/platform-1.3.6.tgz#48b4ce983164b209c2d45a107adb31f473a6e7a7"
integrity sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==

proxy-addr@~2.0.7:
version "2.0.7"
resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025"
Expand Down

0 comments on commit 556c1a1

Please sign in to comment.