Skip to content

Commit 16e9c21

Browse files
committed
feat: migration to ESM
1 parent 15511f2 commit 16e9c21

17 files changed

+860
-880
lines changed

benches/index.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
#!/usr/bin/env ts-node
22

3-
import type { Summary } from 'benny/lib/internal/common-types';
3+
import type { Summary } from 'benny/lib/internal/common-types.js';
44
import fs from 'fs';
55
import path from 'path';
66
import si from 'systeminformation';
7-
import { fsWalk, resultsPath, suitesPath } from './utils';
7+
import { fsWalk, resultsPath, suitesPath } from './utils.js';
8+
import url from "node:url";
9+
10+
const dirname = url.fileURLToPath(new URL('.', import.meta.url));
811

912
async function main(): Promise<void> {
10-
await fs.promises.mkdir(path.join(__dirname, 'results'), { recursive: true });
13+
await fs.promises.mkdir(path.join(dirname, 'results'), { recursive: true });
1114
// Running all suites
1215
for await (const suitePath of fsWalk(suitesPath)) {
1316
// Skip over non-ts and non-js files
@@ -44,12 +47,12 @@ async function main(): Promise<void> {
4447
system: 'model, manufacturer',
4548
});
4649
await fs.promises.writeFile(
47-
path.join(__dirname, 'results', 'system.json'),
50+
path.join(dirname, 'results', 'system.json'),
4851
JSON.stringify(systemData, null, 2),
4952
);
5053
}
5154

52-
if (require.main === module) {
55+
if (process.argv[1] === url.fileURLToPath(import.meta.url)) {
5356
void main();
5457
}
5558

benches/results/buffers/buffer_allocation.chart.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</head>
2929
<body>
3030
<div class="container">
31-
<canvas id="chart1697506316266" width="16" height="9"></canvas>
31+
<canvas id="chart1742766771139" width="16" height="9"></canvas>
3232
</div>
3333
<script>
3434
const format = (num) => {
@@ -51,18 +51,18 @@
5151
chunked.map((chunk) => chunk.join('')).join(' ') + fractionStr
5252
)
5353
}
54-
const ctx1697506316266 = document
55-
.getElementById('chart1697506316266')
54+
const ctx1742766771139 = document
55+
.getElementById('chart1742766771139')
5656
.getContext('2d')
57-
const chart1697506316266 = new Chart(ctx1697506316266, {
57+
const chart1742766771139 = new Chart(ctx1742766771139, {
5858
type: 'bar',
5959
data: {
6060
labels: ["Buffer.alloc","Buffer.allocUnsafe","Buffer.allocUnsafeSlow","Buffer.from subarray","Buffer.copyBytesFrom","Uint8Array","Uint8Array slice"],
6161
datasets: [
6262
{
63-
data: [1342250,7102874,1589200,3509682,936376,1310106,1435174],
64-
backgroundColor: ["hsl(22.680000000000007, 85%, 55%)","hsl(120, 85%, 55%)","hsl(26.844000000000005, 85%, 55%)","hsl(59.292, 85%, 55%)","hsl(15.816000000000006, 85%, 55%)","hsl(22.127999999999997, 85%, 55%)","hsl(24.251999999999995, 85%, 55%)"],
65-
borderColor: ["hsl(22.680000000000007, 85%, 55%)","hsl(120, 85%, 55%)","hsl(26.844000000000005, 85%, 55%)","hsl(59.292, 85%, 55%)","hsl(15.816000000000006, 85%, 55%)","hsl(22.127999999999997, 85%, 55%)","hsl(24.251999999999995, 85%, 55%)"],
63+
data: [1032787,4623286,883781,2081750,714669,1427538,977980],
64+
backgroundColor: ["hsl(26.808000000000007, 85%, 55%)","hsl(120, 85%, 55%)","hsl(22.944000000000003, 85%, 55%)","hsl(54.036, 85%, 55%)","hsl(18.551999999999992, 85%, 55%)","hsl(37.056, 85%, 55%)","hsl(25.380000000000006, 85%, 55%)"],
65+
borderColor: ["hsl(26.808000000000007, 85%, 55%)","hsl(120, 85%, 55%)","hsl(22.944000000000003, 85%, 55%)","hsl(54.036, 85%, 55%)","hsl(18.551999999999992, 85%, 55%)","hsl(37.056, 85%, 55%)","hsl(25.380000000000006, 85%, 55%)"],
6666
borderWidth: 2,
6767
},
6868
],

0 commit comments

Comments
 (0)