chore: add benchmark scripts for deno (#337)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Yusuke Wada · committed by GitHub · parent fb8c7b5 · Browse files · 7 files·+111 added−0 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
7 files+111 added−0 removed
- other:+111 added−0 removed
Provenance
- Commit
c65e811- Tree
26b9c5f- Author
Yusuke Wada <yusuke@kamawada.com>- Committer
GitHub <noreply@github.com>- Parent
fb8c7b5
7 files changed+111 added−0 removed
added:benchmarks/deno/.vscode/settings.json+12 added
123456789101112{ "eslint.validate": [ "javascript", "javascriptreact", "typescript", "typescriptreact" ], "editor.codeActionsOnSave": { "source.fixAll.eslint": true }, "deno.enable": true}No newline at end of fileadded:benchmarks/deno/.gitignore+1 added
1+*.sqliteadded:benchmarks/deno/faster.ts+18 added
123456789101112131415161718import { res, Server } from 'https://deno.land/x/faster@v5.7/mod.ts'const app = new Server()
app.get('/user', () => {})app.get('/user/comments', () => {})app.get('/user/avatar', () => {})app.get('/user/lookup/email/:address', () => {})app.get('/event/:id', () => {})app.get('/event/:id/comments', () => {})app.post('/event/:id/comments', () => {})app.post('/status', () => {})app.get('/very/deeply/nested/route/hello/there', () => {})app.get('/user/lookup/username/:username', res('json'), async (ctx: any, next: any) => { ctx.res.body = { message: `Hello ${ctx.params.username}` } await next()})
await app.listen({ port: 8000 })added:benchmarks/deno/hono-reg-exp-router.ts+19 added
12345678910111213141516171819import { serve } from 'https://deno.land/std@0.146.0/http/server.ts'import { Hono, RegExpRouter } from '../../deno_dist/mod.ts'
const app = new Hono({ router: new RegExpRouter() })
app.get('/user', (c) => c.text('User'))app.get('/user/comments', (c) => c.text('User Comments'))app.get('/user/avatar', (c) => c.text('User Avatar'))app.get('/user/lookup/email/:address', (c) => c.text('User Lookup Email Address'))app.get('/event/:id', (c) => c.text('Event'))app.get('/event/:id/comments', (c) => c.text('Event Comments'))app.post('/event/:id/comments', (c) => c.text('POST Event Comments'))app.post('/status', (c) => c.text('Status'))app.get('/very/deeply/nested/route/hello/there', (c) => c.text('Very Deeply Nested Route'))app.get('/user/lookup/username/:username', (c) => { return c.json({ message: `Hello ${c.req.param('username')}` })})
serve(app.fire())added:benchmarks/deno/hono.ts+19 added
12345678910111213141516171819import { serve } from 'https://deno.land/std@0.146.0/http/server.ts'import { Hono } from '../../deno_dist/mod.ts'
const app = new Hono()
app.get('/user', (c) => c.text('User'))app.get('/user/comments', (c) => c.text('User Comments'))app.get('/user/avatar', (c) => c.text('User Avatar'))app.get('/user/lookup/email/:address', (c) => c.text('User Lookup Email Address'))app.get('/event/:id', (c) => c.text('Event'))app.get('/event/:id/comments', (c) => c.text('Event Comments'))app.post('/event/:id/comments', (c) => c.text('POST Event Comments'))app.post('/status', (c) => c.text('Status'))app.get('/very/deeply/nested/route/hello/there', (c) => c.text('Very Deeply Nested Route'))app.get('/user/lookup/username/:username', (c) => { return c.json({ message: `Hello ${c.req.param('username')}` })})
serve(app.fire())added:benchmarks/deno/oak.ts+24 added
123456789101112131415161718192021222324import { Application, Router } from 'https://deno.land/x/oak@v10.5.1/mod.ts'
const router = new Router()
router.get('/user', () => {})router.get('/user/comments', () => {})router.get('/user/avatar', () => {})router.get('/user/lookup/email/:address', () => {})router.get('/event/:id', () => {})router.get('/event/:id/comments', () => {})router.post('/event/:id/comments', () => {})router.post('/status', () => {})router.get('/very/deeply/nested/route/hello/there', () => {})router.get('/user/lookup/username/:username', (ctx) => { ctx.response.body = { message: `Hello ${ctx.params.username}`, }})
const app = new Application()app.use(router.routes())app.use(router.allowedMethods())
await app.listen({ port: 8000 })added:benchmarks/deno/opine.ts+18 added
123456789101112131415161718import { opine } from 'https://deno.land/x/opine@2.2.0/mod.ts'
const app = opine()
app.get('/user', () => {})app.get('/user/comments', () => {})app.get('/user/avatar', () => {})app.get('/user/lookup/email/:address', () => {})app.get('/event/:id', () => {})app.get('/event/:id/comments', () => {})app.post('/event/:id/comments', () => {})app.post('/status', () => {})app.get('/very/deeply/nested/route/hello/there', () => {})app.get('/user/lookup/username/:username', (req, res) => { res.send({ message: `Hello ${req.params.username}` })})
app.listen(8000)