Skip to content

Commit 908647b

Browse files
committed
fixes
1 parent c1c9193 commit 908647b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

test/benchmarks/driver_bench/src/main.mts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
} from './driver.mjs';
1919

2020
const __dirname = import.meta.dirname;
21+
const alphabetically = (a: string, b: string) => String.prototype.localeCompare.call(a, b);
2122

2223
/** Find every mjs file in the suites folder */
2324
async function getBenchmarks(): Promise<
@@ -28,8 +29,12 @@ async function getBenchmarks(): Promise<
2829
Record<string, { benchFile: string } & Record<string, any>>
2930
> = Object.create(null);
3031
const suites = await fs.readdir(path.join(__dirname, 'suites'));
32+
suites.sort(alphabetically);
33+
3134
for (const suite of suites) {
3235
const benchmarks = await fs.readdir(path.join(__dirname, 'suites', suite));
36+
benchmarks.sort(alphabetically);
37+
3338
for (const benchmark of benchmarks) {
3439
if (!benchmark.endsWith('.mjs')) continue;
3540
tests[suite] ??= Object.create(null);

test/benchmarks/driver_bench/src/runner.mts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ function percentileIndex(percentile: number, count: number) {
8888
}
8989

9090
const medianExecution = durations[percentileIndex(50, count)];
91+
const megabytesPerSecond = benchmark.taskSize / medianExecution;
9192

9293
console.log(
9394
' ',
@@ -100,12 +101,12 @@ console.log(
100101
'median exec time',
101102
medianExecution,
102103
'sec',
103-
benchmark.taskSize / medianExecution,
104+
megabytesPerSecond,
104105
'mb/sec'
105106
);
106107

107108
await fs.writeFile(
108109
`results_${path.basename(benchmarkFile, '.mjs')}.json`,
109-
JSON.stringify(metrics(benchmarkName, medianExecution, count), undefined, 2) + '\n',
110+
JSON.stringify(metrics(benchmarkName, megabytesPerSecond, count), undefined, 2) + '\n',
110111
'utf8'
111112
);

0 commit comments

Comments
 (0)