Skip to content

Commit abbdf53

Browse files
authored
Merge pull request #40 from MatrixAI/feature-esm
ESM Migration
2 parents a005d18 + 199608e commit abbdf53

Some content is hidden

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

53 files changed

+3222
-3292
lines changed

.eslintrc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@
77
"jest": true
88
},
99
"parser": "@typescript-eslint/parser",
10+
"plugins": [
11+
"import"
12+
],
1013
"extends": [
1114
"eslint:recommended",
1215
"plugin:@typescript-eslint/recommended",
13-
"plugin:prettier/recommended",
14-
"prettier"
15-
],
16-
"plugins": [
17-
"import"
16+
"plugin:prettier/recommended"
1817
],
1918
"parserOptions": {
2019
"project": "tsconfig.json",

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ npm install
3636
# build the dist
3737
npm run build
3838
# run the repl (this allows you to import from ./src)
39-
npm run ts-node
39+
npm run tsx
4040
# run the tests
4141
npm run test
4242
# lint the source code

benches/index.ts

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

3-
import type { Summary } from 'benny/lib/internal/common-types';
4-
import fs from 'fs';
5-
import path from 'path';
3+
import type { Summary } from 'benny/lib/internal/common-types.js';
4+
import fs from 'node:fs';
5+
import path from 'node:path';
6+
import url from 'node:url';
67
import si from 'systeminformation';
7-
import { fsWalk, resultsPath, suitesPath } from './utils';
8+
import { fsWalk, resultsPath, suitesPath } from './utils.js';
9+
10+
const projectPath = path.dirname(url.fileURLToPath(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(projectPath, 'results'), {
14+
recursive: true,
15+
});
1116
// Running all suites
1217
for await (const suitePath of fsWalk(suitesPath)) {
1318
// Skip over non-ts and non-js files
@@ -39,13 +44,16 @@ async function main(): Promise<void> {
3944
system: 'model, manufacturer',
4045
});
4146
await fs.promises.writeFile(
42-
path.join(__dirname, 'results', 'system.json'),
47+
path.join(projectPath, 'results', 'system.json'),
4348
JSON.stringify(systemData, null, 2),
4449
);
4550
}
4651

47-
if (require.main === module) {
48-
void main();
52+
if (import.meta.url.startsWith('file:')) {
53+
const modulePath = url.fileURLToPath(import.meta.url);
54+
if (process.argv[1] === modulePath) {
55+
void main();
56+
}
4957
}
5058

5159
export default main;

benches/results/baseline_tcp/baseline_tcp_1KiB.chart.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</head>
2929
<body>
3030
<div class="container">
31-
<canvas id="chart1696055902804" width="16" height="9"></canvas>
31+
<canvas id="chart1720073097150" width="16" height="9"></canvas>
3232
</div>
3333
<script>
3434
const format = (num) => {
@@ -51,16 +51,16 @@
5151
chunked.map((chunk) => chunk.join('')).join(' ') + fractionStr
5252
)
5353
}
54-
const ctx1696055902804 = document
55-
.getElementById('chart1696055902804')
54+
const ctx1720073097150 = document
55+
.getElementById('chart1720073097150')
5656
.getContext('2d')
57-
const chart1696055902804 = new Chart(ctx1696055902804, {
57+
const chart1720073097150 = new Chart(ctx1720073097150, {
5858
type: 'bar',
5959
data: {
6060
labels: ["send 1KiB of data over tcp"],
6161
datasets: [
6262
{
63-
data: [1181126],
63+
data: [1197455],
6464
backgroundColor: ["hsl(120, 85%, 55%)"],
6565
borderColor: ["hsl(120, 85%, 55%)"],
6666
borderWidth: 2,

benches/results/baseline_tcp/baseline_tcp_1KiB.json

Lines changed: 100 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,120 +1,118 @@
11
{
22
"name": "baseline_tcp.baseline_tcp_1KiB",
3-
"date": "2023-09-30T06:38:22.804Z",
4-
"version": "1.1.2-alpha.0",
3+
"date": "2024-07-04T06:04:57.150Z",
4+
"version": "1.2.0",
55
"results": [
66
{
77
"name": "send 1KiB of data over tcp",
8-
"ops": 1181126,
9-
"margin": 1.61,
8+
"ops": 1197455,
9+
"margin": 1.05,
1010
"options": {
1111
"delay": 0.005,
1212
"initCount": 1,
1313
"minTime": 0.05,
1414
"maxTime": 5,
1515
"minSamples": 5
1616
},
17-
"samples": 88,
17+
"samples": 86,
1818
"promise": true,
1919
"details": {
20-
"min": 8.025862462006078e-7,
21-
"max": 0.0000011557177684903748,
22-
"mean": 8.46650033352618e-7,
23-
"median": 8.260562310030395e-7,
24-
"standardDeviation": 6.509178411373037e-8,
25-
"marginOfError": 1.3600062701873817e-8,
26-
"relativeMarginOfError": 1.6063381758835389,
27-
"standardErrorOfMean": 6.938807500956029e-9,
28-
"sampleVariance": 4.236940359108481e-15,
20+
"min": 7.872292145296492e-7,
21+
"max": 0.0000010375294008072029,
22+
"mean": 8.351045249692836e-7,
23+
"median": 8.267533784367521e-7,
24+
"standardDeviation": 4.1459856304821e-8,
25+
"marginOfError": 8.762633312651222e-9,
26+
"relativeMarginOfError": 1.0492858140091537,
27+
"standardErrorOfMean": 4.4707312819649095e-9,
28+
"sampleVariance": 1.7189196848164058e-15,
2929
"sampleResults": [
30-
8.025862462006078e-7,
31-
8.03648983662614e-7,
32-
8.039294262917933e-7,
33-
8.044789133738602e-7,
34-
8.045253292806484e-7,
35-
8.054319750506585e-7,
36-
8.055856921225938e-7,
37-
8.056397384751773e-7,
38-
8.058072441742654e-7,
39-
8.062257472137792e-7,
40-
8.067277102330294e-7,
41-
8.067739203394123e-7,
42-
8.072718465045592e-7,
43-
8.084141970618034e-7,
44-
8.085482522796352e-7,
45-
8.091294801165147e-7,
46-
8.098447315096251e-7,
47-
8.102786062563324e-7,
48-
8.104178223150963e-7,
49-
8.104645548378927e-7,
50-
8.10608282674772e-7,
51-
8.116608567629179e-7,
52-
8.121379812563323e-7,
53-
8.14140039260385e-7,
54-
8.145973594224925e-7,
55-
8.146150740881458e-7,
56-
8.147731287993922e-7,
57-
8.153323518237082e-7,
58-
8.16394962639311e-7,
59-
8.165050658561298e-7,
60-
8.176213589159069e-7,
61-
8.179128197821682e-7,
62-
8.190771276595745e-7,
63-
8.202630604103344e-7,
64-
8.209280648429584e-7,
65-
8.226055597771023e-7,
66-
8.228033814589666e-7,
67-
8.23558748100304e-7,
68-
8.240571966818642e-7,
69-
8.242727805217832e-7,
70-
8.251453584093212e-7,
71-
8.252388551165146e-7,
72-
8.257268553698075e-7,
73-
8.259796890830801e-7,
74-
8.26132772922999e-7,
75-
8.280350968844985e-7,
76-
8.281518965298885e-7,
77-
8.285946523556232e-7,
78-
8.287513614488349e-7,
79-
8.288011968085106e-7,
80-
8.29397812183384e-7,
81-
8.296614583333333e-7,
82-
8.300739931610941e-7,
83-
8.302834504812563e-7,
84-
8.314867812816615e-7,
85-
8.32768316236069e-7,
86-
8.339158434650456e-7,
87-
8.35913864614995e-7,
88-
8.372416571681864e-7,
89-
8.375121738855117e-7,
90-
8.377409289513678e-7,
91-
8.379643015450861e-7,
92-
8.386655110182371e-7,
93-
8.397846061296859e-7,
94-
8.414691141084093e-7,
95-
8.422453615754814e-7,
96-
8.448306737588652e-7,
97-
8.448482617781155e-7,
98-
8.460782991388044e-7,
99-
8.464613886778115e-7,
100-
8.489163025582573e-7,
101-
8.515620092451874e-7,
102-
8.565296510891591e-7,
103-
8.613521561550152e-7,
104-
8.71337734295846e-7,
105-
8.748560821935157e-7,
106-
8.868078457446809e-7,
107-
8.955083903242148e-7,
108-
8.969117749493415e-7,
109-
9.060958713272543e-7,
110-
9.324358219351571e-7,
111-
9.800628641084093e-7,
112-
9.9998477077001e-7,
113-
0.0000010309266084093212,
114-
0.0000010391319497213778,
115-
0.000001044676370947315,
116-
0.0000010638918123100304,
117-
0.0000011557177684903748
30+
7.872292145296492e-7,
31+
7.892506364483079e-7,
32+
7.898806581806893e-7,
33+
7.941616268239677e-7,
34+
7.954494113172865e-7,
35+
7.97732427817448e-7,
36+
7.982046879850977e-7,
37+
7.985030735796336e-7,
38+
7.988529649177274e-7,
39+
7.995431542999069e-7,
40+
8.003239260303929e-7,
41+
8.017153406119765e-7,
42+
8.027002483700713e-7,
43+
8.041837929762077e-7,
44+
8.043388388699162e-7,
45+
8.066319155541757e-7,
46+
8.067974231605092e-7,
47+
8.072310773051848e-7,
48+
8.079307047500777e-7,
49+
8.080945824278174e-7,
50+
8.092207389009624e-7,
51+
8.095808506200768e-7,
52+
8.098783297112698e-7,
53+
8.100404687985097e-7,
54+
8.112343371623719e-7,
55+
8.117929524992238e-7,
56+
8.119039583980131e-7,
57+
8.121954517230674e-7,
58+
8.129409257293169e-7,
59+
8.129562868674325e-7,
60+
8.135287643588947e-7,
61+
8.151799441167339e-7,
62+
8.165870692331574e-7,
63+
8.179911983855946e-7,
64+
8.181729316070656e-7,
65+
8.182966780502949e-7,
66+
8.21397587075452e-7,
67+
8.216183017696368e-7,
68+
8.223921918658802e-7,
69+
8.250129307668426e-7,
70+
8.250372527313856e-7,
71+
8.256941167339335e-7,
72+
8.263199316982303e-7,
73+
8.271868251752739e-7,
74+
8.272235251239958e-7,
75+
8.27658817137535e-7,
76+
8.284299786623029e-7,
77+
8.28946848804719e-7,
78+
8.295028797869439e-7,
79+
8.311398789195901e-7,
80+
8.31249394597951e-7,
81+
8.314472252972036e-7,
82+
8.320649115207521e-7,
83+
8.325505588326607e-7,
84+
8.347442253958398e-7,
85+
8.352421106672443e-7,
86+
8.357226171996274e-7,
87+
8.358248864930772e-7,
88+
8.377067836075753e-7,
89+
8.393710183172928e-7,
90+
8.401221825520025e-7,
91+
8.429394683223436e-7,
92+
8.430268887070639e-7,
93+
8.431929896841872e-7,
94+
8.443838093759702e-7,
95+
8.452584911518162e-7,
96+
8.498279882024216e-7,
97+
8.514382570470552e-7,
98+
8.550274448928904e-7,
99+
8.568740608506675e-7,
100+
8.573342750698541e-7,
101+
8.605336830790458e-7,
102+
8.654612472124625e-7,
103+
8.709007075131155e-7,
104+
8.711753803166718e-7,
105+
8.730834523439925e-7,
106+
8.73613407626676e-7,
107+
8.8209537410742e-7,
108+
8.826423315740453e-7,
109+
8.826615648714123e-7,
110+
8.870778174479976e-7,
111+
8.978099180183215e-7,
112+
9.490311562464905e-7,
113+
9.495302629287828e-7,
114+
9.826761971095246e-7,
115+
0.0000010375294008072029
118116
]
119117
},
120118
"completed": true,
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# TYPE baseline_tcp.baseline_tcp_1KiB_ops gauge
2-
baseline_tcp.baseline_tcp_1KiB_ops{name="send 1KiB of data over tcp"} 1181126
2+
baseline_tcp.baseline_tcp_1KiB_ops{name="send 1KiB of data over tcp"} 1197455
33

44
# TYPE baseline_tcp.baseline_tcp_1KiB_margin gauge
5-
baseline_tcp.baseline_tcp_1KiB_margin{name="send 1KiB of data over tcp"} 1.61
5+
baseline_tcp.baseline_tcp_1KiB_margin{name="send 1KiB of data over tcp"} 1.05
66

77
# TYPE baseline_tcp.baseline_tcp_1KiB_samples counter
8-
baseline_tcp.baseline_tcp_1KiB_samples{name="send 1KiB of data over tcp"} 88
8+
baseline_tcp.baseline_tcp_1KiB_samples{name="send 1KiB of data over tcp"} 86

benches/results/baseline_websocket/baseline_websocket_1KiB.chart.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</head>
2929
<body>
3030
<div class="container">
31-
<canvas id="chart1696055909145" width="16" height="9"></canvas>
31+
<canvas id="chart1720073104226" width="16" height="9"></canvas>
3232
</div>
3333
<script>
3434
const format = (num) => {
@@ -51,16 +51,16 @@
5151
chunked.map((chunk) => chunk.join('')).join(' ') + fractionStr
5252
)
5353
}
54-
const ctx1696055909145 = document
55-
.getElementById('chart1696055909145')
54+
const ctx1720073104226 = document
55+
.getElementById('chart1720073104226')
5656
.getContext('2d')
57-
const chart1696055909145 = new Chart(ctx1696055909145, {
57+
const chart1720073104226 = new Chart(ctx1720073104226, {
5858
type: 'bar',
5959
data: {
6060
labels: ["send 1KiB of data over ws"],
6161
datasets: [
6262
{
63-
data: [83129],
63+
data: [72202],
6464
backgroundColor: ["hsl(120, 85%, 55%)"],
6565
borderColor: ["hsl(120, 85%, 55%)"],
6666
borderWidth: 2,

0 commit comments

Comments
 (0)