Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: enable formatting perf-measures #3683

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"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",
"lint": "eslint src runtime-tests",
"lint:fix": "eslint src runtime-tests --fix",
"format": "prettier --check --cache \"src/**/*.{js,ts,tsx}\" \"runtime-tests/**/*.{js,ts,tsx}\" \"build/**/*.{js,ts,tsx}\"",
"format:fix": "prettier --write --cache --cache-strategy metadata \"src/**/*.{js,ts,tsx}\" \"runtime-tests/**/*.{js,ts,tsx}\" \"build/**/*.{js,ts,tsx}\"",
"format": "prettier --check --cache \"src/**/*.{js,ts,tsx}\" \"runtime-tests/**/*.{js,ts,tsx}\" \"build/**/*.{js,ts,tsx}\" \"perf-measures/**/*.{js,ts,tsx}\"",
"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}\"",
"copy:package.cjs.json": "cp ./package.cjs.json ./dist/cjs/package.json && cp ./package.cjs.json ./dist/types/package.json",
"build": "bun run --shell bun remove-dist && bun ./build/build.ts && bun run copy:package.cjs.json",
"postbuild": "publint",
Expand Down Expand Up @@ -654,4 +654,4 @@
"engines": {
"node": ">=16.9.0"
}
}
}
16 changes: 8 additions & 8 deletions perf-measures/bundle-check/scripts/process-results.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import * as fs from 'node:fs/promises'

async function main() {
const currentResult = (await fs.readFile('./generated/after.js')).byteLength
let previousResult: number | null = null
try {
previousResult = (await fs.readFile('./generated/before.js')).byteLength
} catch (e) {}
const table = ['| | Current | Previous |', '| --- | --- | --- |']
table.push(`| Bundle Size | ${currentResult} | ${previousResult || 'N/A'} |`)
console.log(table.join('\n'))
const currentResult = (await fs.readFile('./generated/after.js')).byteLength
let previousResult: number | null = null
try {
previousResult = (await fs.readFile('./generated/before.js')).byteLength
} catch (e) {}
const table = ['| | Current | Previous |', '| --- | --- | --- |']
table.push(`| Bundle Size | ${currentResult} | ${previousResult || 'N/A'} |`)
console.log(table.join('\n'))
}

main()
4 changes: 3 additions & 1 deletion perf-measures/type-check/scripts/generate-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export const app = new Hono()`
const routes = generateRoutes(count)

writeFile(path.join(import.meta.dirname, '../generated/app.ts'), routes, (err) => {
if (err) { throw err }
if (err) {
throw err
}
console.log(`${count} routes have been written to app.ts`)
})
25 changes: 14 additions & 11 deletions perf-measures/type-check/scripts/process-results.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import * as fs from 'node:fs/promises'

async function main() {
const currentResult = (await fs.readFile('./result.txt')).toString().split('\n')
const previousResult = await fs.readFile('./previous-result.txt')
.then((data) => data.toString().split('\n'))
.catch(() => null)
const table = ['| | Current | Previous |', '| --- | --- | --- |']
for (const [i, line] of currentResult.entries()) {
if (line === '') {continue}
const [name, value] = line.split(':')
const mainValue = previousResult?.[i]?.split(':')?.[1]
table.push(`| ${name?.trim()} | ${value?.trim()} | ${mainValue ? mainValue.trim() : 'N/A'} |`)
const currentResult = (await fs.readFile('./result.txt')).toString().split('\n')
const previousResult = await fs
.readFile('./previous-result.txt')
.then((data) => data.toString().split('\n'))
.catch(() => null)
const table = ['| | Current | Previous |', '| --- | --- | --- |']
for (const [i, line] of currentResult.entries()) {
if (line === '') {
continue
}
console.log(table.join('\n'))
const [name, value] = line.split(':')
const mainValue = previousResult?.[i]?.split(':')?.[1]
table.push(`| ${name?.trim()} | ${value?.trim()} | ${mainValue ? mainValue.trim() : 'N/A'} |`)
}
console.log(table.join('\n'))
}

main()
Loading