Skip to content

Commit 1946129

Browse files
feat!: update to tinybench v6, revisit repo
1 parent bf1b62b commit 1946129

41 files changed

Lines changed: 2964 additions & 5582 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 112 additions & 114 deletions
Large diffs are not rendered by default.

bun.lock

Lines changed: 1608 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eslint.config.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
import antfu from '@antfu/eslint-config'
1+
import eslint from "@monstermann/eslint-config"
22

3-
export default antfu({
4-
yaml: false,
5-
typescript: true,
6-
stylistic: {
7-
indent: 4,
8-
},
9-
rules: {
10-
'antfu/if-newline': 'off',
11-
'ts/consistent-type-definitions': 'off',
12-
'style/comma-dangle': ['error', 'always-multiline'],
13-
'test/no-import-node-test': 'off',
14-
},
15-
})
3+
export default eslint()

fixtures/bench.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { createBench } from './createBench.js'
1+
import { createBench } from "./createBench.js"
22

33
export const bench = createBench([
4-
{ name: 'A', time: 0.000001, samples: 1_000_000_000, margin: 1.00 },
5-
{ name: 'B', time: 0.001, samples: 1_000_000, margin: 1.50 },
6-
{ name: 'C', time: 1, samples: 1_000, margin: 2.00 },
7-
{ name: 'D', time: 1000, samples: 100, margin: 2.50 },
4+
{ margin: 1.00, name: "A", samples: 1_000_000_000, time: 0.000001 },
5+
{ margin: 1.50, name: "B", samples: 1_000_000, time: 0.001 },
6+
{ margin: 2.00, name: "C", samples: 1_000, time: 1 },
7+
{ margin: 2.50, name: "D", samples: 100, time: 1000 },
88
])

fixtures/createBench.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { Bench } from 'tinybench'
2-
import { createTask } from './createTask.js'
3-
import type { TaskOptions } from './types.js'
1+
import type { Bench } from "tinybench"
2+
import type { TaskOptions } from "./types.js"
3+
import { createTask } from "./createTask.js"
44

55
export function createBench(tasks: TaskOptions[]) {
66
return {

fixtures/createTask.ts

Lines changed: 54 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,68 @@
1-
import type { Task } from 'tinybench'
2-
import type { TaskWithResult } from '../src/types.js'
3-
import type { TaskOptions } from './types.js'
1+
import type { Task } from "tinybench"
2+
import type { TaskWithResult } from "../src/types.js"
3+
import type { TaskOptions } from "./types.js"
44

55
export function createTask({
6-
name = '',
7-
time = 0,
86
margin = 0,
7+
name = "",
98
samples = 0,
9+
time = 0,
1010
}: TaskOptions) {
1111
return {
1212
name,
1313
result: {
14-
hz: 1000 / time,
15-
mean: time,
16-
rme: margin,
17-
samples: { length: samples },
14+
period: 0.012473746164400444,
15+
runtime: "bun",
16+
runtimeVersion: "1.3.3",
17+
state: "completed",
18+
timestampProviderName: "performanceNow",
19+
totalTime: 100.00202299999836,
20+
latency: {
21+
aad: 0.0006042830658793024,
22+
critical: 1.96,
23+
df: 8016,
24+
mad: 0.00009999999997489795,
25+
max: 0.0699510000000032,
26+
mean: time,
27+
min: 0.011762000000032913,
28+
moe: 0.00003765203626542283,
29+
p50: 0.01223299999998062,
30+
p75: 0.012243000000012216,
31+
p99: 0.02187660000003008,
32+
p995: 0.023003000000016982,
33+
p999: 0.028401624000000354,
34+
rme: 0.30185026830897227,
35+
samples: undefined,
36+
samplesCount: samples,
37+
sd: 0.001720039176593652,
38+
sem: 0.000019210222584399406,
39+
variance: 0.0000029585347690169686,
40+
},
41+
throughput: {
42+
aad: 2584.591517912362,
43+
critical: 1.96,
44+
df: 8016,
45+
mad: 662.8241028443299,
46+
max: 85019.55449729653,
47+
mean: 1000 / time,
48+
min: 14295.721290617063,
49+
moe: 132.13434972230343,
50+
p50: 81746.09662401571,
51+
p75: 83243.15325047553,
52+
p99: 83634.48787635835,
53+
p995: 84875.23340660904,
54+
p999: 84947.33265369936,
55+
rme: margin,
56+
samples: undefined,
57+
samplesCount: samples,
58+
sd: 6036.227536113473,
59+
sem: 67.41548455219562,
60+
variance: 36436042.86773454,
61+
},
1862
},
1963
} as TaskWithResult
2064
}
2165

22-
export function createInvalidTask() {
23-
return { name: '', result: undefined } as Task
24-
}
25-
2666
export function createFailedTask() {
27-
return { name: '', result: { error: new Error('Whoops') } } as Task
67+
return { name: "", result: { error: new Error("Whoops"), state: "errored" } } as Task
2868
}

fixtures/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export type TaskOptions = Partial<{
2-
name: string
3-
time: number
42
margin: number
3+
name: string
54
samples: number
5+
time: number
66
}>

package.json

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
{
2-
32
"name": "@monstermann/tinybench-pretty-printer",
43
"type": "module",
54
"version": "0.2.0",
6-
"packageManager": "pnpm@9.1.1",
75
"description": "Customizable pretty-printer for tinybench benchmarks",
86
"author": "Michael Ostermann <michaelostermann@me.com>",
97
"license": "MIT",
@@ -41,44 +39,35 @@
4139
"exports": {
4240
".": {
4341
"types": "./dist/index.d.ts",
44-
"import": "./dist/index.js",
42+
"import": "./dist/index.mjs",
4543
"require": "./dist/index.cjs"
4644
}
4745
},
48-
"main": "./dist/index.js",
49-
"module": "./dist/index.js",
50-
"types": "./dist/index.d.ts",
46+
"main": "./dist/index.cjs",
47+
"module": "./dist/index.mjs",
48+
"types": "./dist/index.d.mts",
5149
"files": [
5250
"./dist/**"
5351
],
5452
"scripts": {
55-
"build": "tsup",
56-
"prepublishOnly": "tsup",
57-
"lint": "eslint .",
58-
"typecheck": "tsc --noEmit",
59-
"test": "tsx --test"
53+
"checks": "bun run eslint && bun run tsc && bun test",
54+
"bundles": "tsdown",
55+
"release": "bun run checks && bun run bundles && bun run bumpp -r --no-push && bun publish --access public"
6056
},
6157
"peerDependencies": {
62-
"tinybench": "^5.0.0"
58+
"tinybench": "^6.0.0"
6359
},
6460
"dependencies": {
6561
"@monstermann/tables": "^0.0.0",
6662
"picocolors": "^1.0.1"
6763
},
6864
"devDependencies": {
69-
"@antfu/eslint-config": "^2.27.3",
65+
"@monstermann/eslint-config": "^0.5.0",
7066
"@sindresorhus/tsconfig": "^5.1.1",
71-
"@types/node": "^20.19.11",
72-
"eslint": "^9.1.1",
73-
"tinybench": "^5.0.0",
74-
"tsup": "^8.0.2",
75-
"tsx": "^4.11.0",
67+
"@types/bun": "^1.3.3",
68+
"bumpp": "^10.2.0",
69+
"tinybench": "^6.0.0",
70+
"tsdown": "0.16.8",
7671
"typescript": "^5.4.5"
77-
},
78-
"tsup": {
79-
"clean": true,
80-
"dts": true,
81-
"entry": ["./src/index.ts"],
82-
"format": ["esm", "cjs"]
8372
}
8473
}

0 commit comments

Comments
 (0)