Skip to content

Commit 3b5bcf0

Browse files
committed
chore: bump tinybench and use table report
1 parent 03de0f0 commit 3b5bcf0

File tree

10 files changed

+2958
-6415
lines changed

10 files changed

+2958
-6415
lines changed

examples/with-javascript-cjs/tinybench.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,5 @@ bench
2020
});
2121

2222
bench.run().then(() => {
23-
console.table(
24-
bench.tasks.map(({ name, result }) => ({
25-
"Task Name": name,
26-
"Average Time (ps)": result?.mean ? result.mean * 1000 : "N/A",
27-
"Variance (ps)": result?.variance ? result.variance * 1000 : "N/A",
28-
}))
29-
);
23+
console.table(bench.table());
3024
});

examples/with-javascript-esm/tinybench.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,5 @@ bench
2020
});
2121

2222
bench.run().then(() => {
23-
console.table(
24-
bench.tasks.map(({ name, result }) => ({
25-
"Task Name": name,
26-
"Average Time (ps)": result?.mean ? result.mean * 1000 : "N/A",
27-
"Variance (ps)": result?.variance ? result.variance * 1000 : "N/A",
28-
}))
29-
);
23+
console.table(bench.table());
3024
});

examples/with-typescript-cjs/bench/tinybench/index.bench.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,5 @@ export const bench = withCodSpeed(new Bench());
1010
registerFoobarbazBenchmarks(bench);
1111

1212
await bench.run();
13-
console.table(
14-
bench.tasks.map(({ name, result }) => ({
15-
"Task Name": name,
16-
"Average Time (ps)": result?.mean ? result.mean * 1000 : "N/A",
17-
"Variance (ps)": result?.variance ? result.variance * 1000 : "N/A",
18-
}))
19-
);
13+
console.table(bench.table());
2014
})();

examples/with-typescript-esm/bench/tinybench/index.bench.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,5 @@ export const bench = withCodSpeed(new Bench());
1010
registerFoobarbazBenchmarks(bench);
1111

1212
await bench.run();
13-
console.table(
14-
bench.tasks.map(({ name, result }) => ({
15-
"Task Name": name,
16-
"Average Time (ps)": result?.mean ? result.mean * 1000 : "N/A",
17-
"Variance (ps)": result?.variance ? result.variance * 1000 : "N/A",
18-
}))
19-
);
13+
console.table(bench.table());
2014
})();

examples/with-typescript-simple-cjs/tinybench.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,5 @@ bench
2020
});
2121

2222
bench.run().then(() => {
23-
console.table(
24-
bench.tasks.map(({ name, result }) => ({
25-
"Task Name": name,
26-
"Average Time (ps)": result?.mean ? result.mean * 1000 : "N/A",
27-
"Variance (ps)": result?.variance ? result.variance * 1000 : "N/A",
28-
}))
29-
);
23+
console.table(bench.table());
3024
});

examples/with-typescript-simple-esm/tinybench.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,5 @@ bench
2020
});
2121

2222
bench.run().then(() => {
23-
console.table(
24-
bench.tasks.map(({ name, result }) => ({
25-
"Task Name": name,
26-
"Average Time (ps)": result?.mean ? result.mean * 1000 : "N/A",
27-
"Variance (ps)": result?.variance ? result.variance * 1000 : "N/A",
28-
}))
29-
);
23+
console.table(bench.table());
3024
});

packages/tinybench-plugin/README.md

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,7 @@ bench
5959
});
6060

6161
await bench.run();
62-
console.table(
63-
bench.tasks.map(({ name, result }) => ({
64-
"Task Name": name,
65-
"Average Time (ps)": result?.mean * 1000,
66-
}))
67-
);
62+
console.table(bench.table());
6863
```
6964

7065
Here, a few things are happening:
@@ -81,12 +76,12 @@ $ node benches/bench.mjs
8176
[CodSpeed] 2 benches detected but no instrumentation found
8277
[CodSpeed] falling back to tinybench
8378

84-
┌─────────┬───────────────┬────────────────────┐
85-
│ (index) │ Task Name │ Average Time (ps)
86-
├─────────┼───────────────┼────────────────────┤
87-
0'fibonacci10'0.5660083779532603
88-
1'fibonacci15'5.2475729101797635
89-
└─────────┴───────────────┴────────────────────┘
79+
┌─────────┬───────────────┬─────────────┬───────────────────┬──────────┬─────────┐
80+
│ (index) │ Task Name │ ops/sec │ Average Time (ns) │ Margin │ Samples
81+
├─────────┼───────────────┼─────────────┼───────────────────┼──────────┼─────────┤
82+
│ 0 │ 'fibonacci10''1,810,236' │ 552.4139857896414 │ '±0.18%' │ 905119
83+
│ 1 │ 'fibonacci15' '177,516' │ 5633.276191749634 │ '±0.14%' │ 88759
84+
└─────────┴───────────────┴─────────────┴───────────────────┴──────────┴─────────┘
9085
```
9186

9287
And... Congrats🎉, CodSpeed is installed in your benchmarking suite! Locally, CodSpeed will fallback to tinybench since the instrumentation is only available in the CI environment for now.

packages/tinybench-plugin/benches/sample.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,5 @@ bench
2020
});
2121

2222
bench.run().then(() => {
23-
console.table(
24-
bench.tasks.map(({ name, result }) => ({
25-
"Task Name": name,
26-
"Average Time (ps)": result?.mean ? result.mean * 1000 : "N/A",
27-
"Variance (ps)": result?.variance ? result.variance * 1000 : "N/A",
28-
}))
29-
);
23+
console.table(bench.table());
3024
});

packages/tinybench-plugin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"@types/find-up": "^4.0.0",
2323
"@types/stack-trace": "^0.0.30",
2424
"jest-mock-extended": "^3.0.4",
25-
"tinybench": "^2.4.0"
25+
"tinybench": "^2.5.0"
2626
},
2727
"dependencies": {
2828
"@codspeed/core": "workspace:^2.1.0",

0 commit comments

Comments
 (0)