Skip to content
Myr

chore: format and lint `benchmarks/*` (#4317)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* chore: format and lint `benchmarks/*` * fomrat

authored by Yusuke Wada · committed by GitHub · parent 46f484c · Browse files · 16 files+26 added−23 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

16 files+26 added−23 removed

  • other:+26 added−23 removed

16 files+26 added−23 removed

modified:benchmarks/deno/fast.ts+2 added-1 removed
modified:benchmarks/handle-event/index.js+1 added
modified:benchmarks/http-server/benchmark.ts+3 added-2 removed
17 unmodified lines
18import { existsSync, mkdirSync, writeFileSync, rmSync } from 'node:fs'19import { join } from 'node:path'2021// Configuration from command line arguments22const baseline =22const baseline = process.argv.find((arg) => arg.startsWith('--baseline='))?.split('=')[1] || 'origin/main'23 process.argv.find((arg) => arg.startsWith('--baseline='))?.split('=')[1] || 'origin/main'24const target = process.argv.find((arg) => arg.startsWith('--target='))?.split('=')[1] || 'current'25const runs = parseInt(process.argv.find((arg) => arg.startsWith('--runs='))?.split('=')[1] || '1')26const duration = parseInt(27 process.argv.find((arg) => arg.startsWith('--duration='))?.split('=')[1] || '10'
72 unmodified lines
100 // No build needed - use src directly101 } else {102 // Ensure we have the latest remote refs103 await runCommand('git fetch origin', HONO_ROOT)103 104105 try {106 const stashResult = await runCommand('git stash push -m "benchmark-temp"', HONO_ROOT)107 needsRestore = stashResult.stdout.includes('Saved working directory')108 if (needsRestore) {
218 unmodified lines
modified:benchmarks/jsx/src/react-jsx/benchmark.ts+1 added-1 removed
11 unmodified lines
12 const html = render()13 const doc = parse(html)14 if (doc.querySelector('p#c').textContent !== '3\nc') {15 throw new Error('Invalid output')16 } 16 }17})1819suite20 .add('Hono', () => {
18 unmodified lines
modified:benchmarks/jsx/src/react-jsx/hono.ts+1 added-1 removed
modified:benchmarks/jsx/src/react-jsx/nano.ts+1 added-1 removed
modified:benchmarks/jsx/src/react-jsx/preact.ts+1 added-1 removed
modified:benchmarks/jsx/src/benchmark.ts+1 added-1 removed
11 unmodified lines
12 const html = render()13 const doc = parse(html)14 if (doc.querySelector('p#c').textContent !== '3\nc') {15 throw new Error('Invalid output')16 } 16 }17})1819suite20 .add('Hono', () => {
18 unmodified lines
modified:benchmarks/jsx/src/hono.ts+2 added-2 removed
1import { jsx, Fragment} from '../../../src/jsx'1import { jsx, Fragment } from '../../../src/jsx'2import { buildPage } from './page'34export const render = () => buildPage({ jsx, Fragment })().toString()4export const render = () => buildPage({ jsx, Fragment })().toString()
modified:benchmarks/jsx/src/nano.ts+1 added-1 removed
1import { h, Fragment, renderSSR } from 'nano-jsx'2import { buildPage } from './page'34export const render = () => renderSSR(buildPage({ jsx: h, Fragment }))4export const render = () => renderSSR(buildPage({ jsx: h, Fragment }))
modified:benchmarks/jsx/src/preact.ts+2 added-2 removed
1import { h, Fragment} from 'preact'1import { h, Fragment } from 'preact'2import { renderToString } from 'preact-render-to-string'3import { buildPage } from './page'45export const render = () => renderToString(buildPage({ jsx: h, Fragment })() as any)5export const render = () => renderToString(buildPage({ jsx: h, Fragment })() as any)
modified:benchmarks/routers/src/bench.mts+1 added-1 removed
5 unmodified lines
6import { koaTreeRouter } from './koa-tree-router.mts'7import { medleyRouter } from './medley-router.mts'8import { memoiristRouter } from './memoirist.mts'9import { radix3Router } from './radix3.mts'10import { rou3Router } from './rou3.mts'11import type { Route, RouterInterface } from './tool.mts'12import { trekRouter } from './trek-router.mts'12import { rou3Router } from './rou3.mts'1314const routers: RouterInterface[] = [15 regExpRouter,16 trieRouter,
73 unmodified lines
modified:benchmarks/routers/src/hono.mts+1 added-1 removed
1import { PatternRouter } from '../../../src/router/pattern-router/index.ts'2import { RegExpRouter } from '../../../src/router/reg-exp-router/index.ts'3import { TrieRouter } from '../../../src/router/trie-router/index.ts'3import { PatternRouter } from '../../../src/router/pattern-router/index.ts'4import type { Router } from '../../../src/router.ts'5import type { RouterInterface } from './tool.mts'6import { routes, handler } from './tool.mts'7
15 unmodified lines
modified:benchmarks/routers-deno/src/hono.mts+2 added-2 removed
1import type { Router } from '../../../src/router.ts'1import { PatternRouter } from '../../../src/router/pattern-router/index.ts'2import { RegExpRouter } from '../../../src/router/reg-exp-router/index.ts'3import { TrieRouter } from '../../../src/router/trie-router/index.ts'4import { PatternRouter } from '../../../src/router/pattern-router/index.ts'4import type { Router } from '../../../src/router.ts'5import type { RouterInterface } from './tool.mts'6import { routes, handler } from './tool.mts'78const createHonoRouter = (name: string, router: Router<unknown>): RouterInterface => {
14 unmodified lines
modified:benchmarks/utils/src/get-path.ts+1 added-1 removed
23 unmodified lines
24 })2526 bench('slice + for-loop + flag', () => {27 const url = request.url28 let start = url.indexOf('/', 8)28 const start = url.indexOf('/', 8)29 let i = start30 let hasPercentEncoding = false31 for (; i < url.length; i++) {32 const charCode = url.charCodeAt(i)
34 unmodified lines
modified:package.json+5 added-5 removed
18 unmodified lines
19 "test:workerd": "vitest --run --config ./runtime-tests/workerd/vitest.config.ts",20 "test:lambda": "vitest --run --config ./runtime-tests/lambda/vitest.config.ts",21 "test:lambda-edge": "vitest --run --config ./runtime-tests/lambda-edge/vitest.config.ts",22 "test:all": "bun run test && bun test:deno && bun test:bun && bun test:fastly && bun test:node && bun test:workerd && bun test:lambda && bun test:lambda-edge",23 "lint": "eslint src runtime-tests build perf-measures",24 "lint:fix": "eslint src runtime-tests build perf-measures --fix",25 "format": "prettier --check --cache \"src/**/*.{js,ts,tsx}\" \"runtime-tests/**/*.{js,ts,tsx}\" \"build/**/*.{js,ts,tsx}\" \"perf-measures/**/*.{js,ts,tsx}\"",26 "format:fix": "prettier --write --cache --cache-strategy metadata \"src/**/*.{js,ts,tsx}\" \"runtime-tests/**/*.{js,ts,tsx}\" \"build/**/*.{js,ts,tsx}\" \"perf-measures/**/*.{js,ts,tsx}\"",23 "lint": "eslint src runtime-tests build perf-measures benchmarks",24 "lint:fix": "eslint src runtime-tests build perf-measures benchmarks --fix",25 "format": "prettier --check --cache \"src/**/*.{js,ts,tsx}\" \"runtime-tests/**/*.{js,ts,tsx}\" \"build/**/*.{js,ts,tsx}\" \"perf-measures/**/*.{js,ts,tsx}\" \"benchmarks/**/*.{js,ts,tsx}\"",26 "format:fix": "prettier --write --cache --cache-strategy metadata \"src/**/*.{js,ts,tsx}\" \"runtime-tests/**/*.{js,ts,tsx}\" \"build/**/*.{js,ts,tsx}\" \"perf-measures/**/*.{js,ts,tsx}\" \"benchmarks/**/*.{js,ts,tsx}\"",27 "copy:package.cjs.json": "cp ./package.cjs.json ./dist/cjs/package.json && cp ./package.cjs.json ./dist/types/package.json",28 "build": "bun run --shell bun remove-dist && bun ./build/build.ts && bun run copy:package.cjs.json",29 "postbuild": "publint",30 "watch": "bun run --shell bun remove-dist && bun ./build/build.ts --watch && bun run copy:package.cjs.json",
653 unmodified lines
684 },685 "engines": {686 "node": ">=16.9.0"687 }688}688}