Skip to content

Commit

Permalink
Merge pull request #40 from MatrixAI/feature-esm
Browse files Browse the repository at this point in the history
ESM Migration
  • Loading branch information
amydevs authored Sep 9, 2024
2 parents a005d18 + 199608e commit abbdf53
Show file tree
Hide file tree
Showing 53 changed files with 3,222 additions and 3,292 deletions.
9 changes: 4 additions & 5 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
"jest": true
},
"parser": "@typescript-eslint/parser",
"plugins": [
"import"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"prettier"
],
"plugins": [
"import"
"plugin:prettier/recommended"
],
"parserOptions": {
"project": "tsconfig.json",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ npm install
# build the dist
npm run build
# run the repl (this allows you to import from ./src)
npm run ts-node
npm run tsx
# run the tests
npm run test
# lint the source code
Expand Down
24 changes: 16 additions & 8 deletions benches/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
#!/usr/bin/env ts-node

import type { Summary } from 'benny/lib/internal/common-types';
import fs from 'fs';
import path from 'path';
import type { Summary } from 'benny/lib/internal/common-types.js';
import fs from 'node:fs';
import path from 'node:path';
import url from 'node:url';
import si from 'systeminformation';
import { fsWalk, resultsPath, suitesPath } from './utils';
import { fsWalk, resultsPath, suitesPath } from './utils.js';

const projectPath = path.dirname(url.fileURLToPath(import.meta.url));

async function main(): Promise<void> {
await fs.promises.mkdir(path.join(__dirname, 'results'), { recursive: true });
await fs.promises.mkdir(path.join(projectPath, 'results'), {
recursive: true,
});
// Running all suites
for await (const suitePath of fsWalk(suitesPath)) {
// Skip over non-ts and non-js files
Expand Down Expand Up @@ -39,13 +44,16 @@ async function main(): Promise<void> {
system: 'model, manufacturer',
});
await fs.promises.writeFile(
path.join(__dirname, 'results', 'system.json'),
path.join(projectPath, 'results', 'system.json'),
JSON.stringify(systemData, null, 2),
);
}

if (require.main === module) {
void main();
if (import.meta.url.startsWith('file:')) {
const modulePath = url.fileURLToPath(import.meta.url);
if (process.argv[1] === modulePath) {
void main();
}
}

export default main;
10 changes: 5 additions & 5 deletions benches/results/baseline_tcp/baseline_tcp_1KiB.chart.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</head>
<body>
<div class="container">
<canvas id="chart1696055902804" width="16" height="9"></canvas>
<canvas id="chart1720073097150" width="16" height="9"></canvas>
</div>
<script>
const format = (num) => {
Expand All @@ -51,16 +51,16 @@
chunked.map((chunk) => chunk.join('')).join(' ') + fractionStr
)
}
const ctx1696055902804 = document
.getElementById('chart1696055902804')
const ctx1720073097150 = document
.getElementById('chart1720073097150')
.getContext('2d')
const chart1696055902804 = new Chart(ctx1696055902804, {
const chart1720073097150 = new Chart(ctx1720073097150, {
type: 'bar',
data: {
labels: ["send 1KiB of data over tcp"],
datasets: [
{
data: [1181126],
data: [1197455],
backgroundColor: ["hsl(120, 85%, 55%)"],
borderColor: ["hsl(120, 85%, 55%)"],
borderWidth: 2,
Expand Down
202 changes: 100 additions & 102 deletions benches/results/baseline_tcp/baseline_tcp_1KiB.json
Original file line number Diff line number Diff line change
@@ -1,120 +1,118 @@
{
"name": "baseline_tcp.baseline_tcp_1KiB",
"date": "2023-09-30T06:38:22.804Z",
"version": "1.1.2-alpha.0",
"date": "2024-07-04T06:04:57.150Z",
"version": "1.2.0",
"results": [
{
"name": "send 1KiB of data over tcp",
"ops": 1181126,
"margin": 1.61,
"ops": 1197455,
"margin": 1.05,
"options": {
"delay": 0.005,
"initCount": 1,
"minTime": 0.05,
"maxTime": 5,
"minSamples": 5
},
"samples": 88,
"samples": 86,
"promise": true,
"details": {
"min": 8.025862462006078e-7,
"max": 0.0000011557177684903748,
"mean": 8.46650033352618e-7,
"median": 8.260562310030395e-7,
"standardDeviation": 6.509178411373037e-8,
"marginOfError": 1.3600062701873817e-8,
"relativeMarginOfError": 1.6063381758835389,
"standardErrorOfMean": 6.938807500956029e-9,
"sampleVariance": 4.236940359108481e-15,
"min": 7.872292145296492e-7,
"max": 0.0000010375294008072029,
"mean": 8.351045249692836e-7,
"median": 8.267533784367521e-7,
"standardDeviation": 4.1459856304821e-8,
"marginOfError": 8.762633312651222e-9,
"relativeMarginOfError": 1.0492858140091537,
"standardErrorOfMean": 4.4707312819649095e-9,
"sampleVariance": 1.7189196848164058e-15,
"sampleResults": [
8.025862462006078e-7,
8.03648983662614e-7,
8.039294262917933e-7,
8.044789133738602e-7,
8.045253292806484e-7,
8.054319750506585e-7,
8.055856921225938e-7,
8.056397384751773e-7,
8.058072441742654e-7,
8.062257472137792e-7,
8.067277102330294e-7,
8.067739203394123e-7,
8.072718465045592e-7,
8.084141970618034e-7,
8.085482522796352e-7,
8.091294801165147e-7,
8.098447315096251e-7,
8.102786062563324e-7,
8.104178223150963e-7,
8.104645548378927e-7,
8.10608282674772e-7,
8.116608567629179e-7,
8.121379812563323e-7,
8.14140039260385e-7,
8.145973594224925e-7,
8.146150740881458e-7,
8.147731287993922e-7,
8.153323518237082e-7,
8.16394962639311e-7,
8.165050658561298e-7,
8.176213589159069e-7,
8.179128197821682e-7,
8.190771276595745e-7,
8.202630604103344e-7,
8.209280648429584e-7,
8.226055597771023e-7,
8.228033814589666e-7,
8.23558748100304e-7,
8.240571966818642e-7,
8.242727805217832e-7,
8.251453584093212e-7,
8.252388551165146e-7,
8.257268553698075e-7,
8.259796890830801e-7,
8.26132772922999e-7,
8.280350968844985e-7,
8.281518965298885e-7,
8.285946523556232e-7,
8.287513614488349e-7,
8.288011968085106e-7,
8.29397812183384e-7,
8.296614583333333e-7,
8.300739931610941e-7,
8.302834504812563e-7,
8.314867812816615e-7,
8.32768316236069e-7,
8.339158434650456e-7,
8.35913864614995e-7,
8.372416571681864e-7,
8.375121738855117e-7,
8.377409289513678e-7,
8.379643015450861e-7,
8.386655110182371e-7,
8.397846061296859e-7,
8.414691141084093e-7,
8.422453615754814e-7,
8.448306737588652e-7,
8.448482617781155e-7,
8.460782991388044e-7,
8.464613886778115e-7,
8.489163025582573e-7,
8.515620092451874e-7,
8.565296510891591e-7,
8.613521561550152e-7,
8.71337734295846e-7,
8.748560821935157e-7,
8.868078457446809e-7,
8.955083903242148e-7,
8.969117749493415e-7,
9.060958713272543e-7,
9.324358219351571e-7,
9.800628641084093e-7,
9.9998477077001e-7,
0.0000010309266084093212,
0.0000010391319497213778,
0.000001044676370947315,
0.0000010638918123100304,
0.0000011557177684903748
7.872292145296492e-7,
7.892506364483079e-7,
7.898806581806893e-7,
7.941616268239677e-7,
7.954494113172865e-7,
7.97732427817448e-7,
7.982046879850977e-7,
7.985030735796336e-7,
7.988529649177274e-7,
7.995431542999069e-7,
8.003239260303929e-7,
8.017153406119765e-7,
8.027002483700713e-7,
8.041837929762077e-7,
8.043388388699162e-7,
8.066319155541757e-7,
8.067974231605092e-7,
8.072310773051848e-7,
8.079307047500777e-7,
8.080945824278174e-7,
8.092207389009624e-7,
8.095808506200768e-7,
8.098783297112698e-7,
8.100404687985097e-7,
8.112343371623719e-7,
8.117929524992238e-7,
8.119039583980131e-7,
8.121954517230674e-7,
8.129409257293169e-7,
8.129562868674325e-7,
8.135287643588947e-7,
8.151799441167339e-7,
8.165870692331574e-7,
8.179911983855946e-7,
8.181729316070656e-7,
8.182966780502949e-7,
8.21397587075452e-7,
8.216183017696368e-7,
8.223921918658802e-7,
8.250129307668426e-7,
8.250372527313856e-7,
8.256941167339335e-7,
8.263199316982303e-7,
8.271868251752739e-7,
8.272235251239958e-7,
8.27658817137535e-7,
8.284299786623029e-7,
8.28946848804719e-7,
8.295028797869439e-7,
8.311398789195901e-7,
8.31249394597951e-7,
8.314472252972036e-7,
8.320649115207521e-7,
8.325505588326607e-7,
8.347442253958398e-7,
8.352421106672443e-7,
8.357226171996274e-7,
8.358248864930772e-7,
8.377067836075753e-7,
8.393710183172928e-7,
8.401221825520025e-7,
8.429394683223436e-7,
8.430268887070639e-7,
8.431929896841872e-7,
8.443838093759702e-7,
8.452584911518162e-7,
8.498279882024216e-7,
8.514382570470552e-7,
8.550274448928904e-7,
8.568740608506675e-7,
8.573342750698541e-7,
8.605336830790458e-7,
8.654612472124625e-7,
8.709007075131155e-7,
8.711753803166718e-7,
8.730834523439925e-7,
8.73613407626676e-7,
8.8209537410742e-7,
8.826423315740453e-7,
8.826615648714123e-7,
8.870778174479976e-7,
8.978099180183215e-7,
9.490311562464905e-7,
9.495302629287828e-7,
9.826761971095246e-7,
0.0000010375294008072029
]
},
"completed": true,
Expand Down
6 changes: 3 additions & 3 deletions benches/results/baseline_tcp/baseline_tcp_1KiB_metrics.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# TYPE baseline_tcp.baseline_tcp_1KiB_ops gauge
baseline_tcp.baseline_tcp_1KiB_ops{name="send 1KiB of data over tcp"} 1181126
baseline_tcp.baseline_tcp_1KiB_ops{name="send 1KiB of data over tcp"} 1197455

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

# TYPE baseline_tcp.baseline_tcp_1KiB_samples counter
baseline_tcp.baseline_tcp_1KiB_samples{name="send 1KiB of data over tcp"} 88
baseline_tcp.baseline_tcp_1KiB_samples{name="send 1KiB of data over tcp"} 86
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</head>
<body>
<div class="container">
<canvas id="chart1696055909145" width="16" height="9"></canvas>
<canvas id="chart1720073104226" width="16" height="9"></canvas>
</div>
<script>
const format = (num) => {
Expand All @@ -51,16 +51,16 @@
chunked.map((chunk) => chunk.join('')).join(' ') + fractionStr
)
}
const ctx1696055909145 = document
.getElementById('chart1696055909145')
const ctx1720073104226 = document
.getElementById('chart1720073104226')
.getContext('2d')
const chart1696055909145 = new Chart(ctx1696055909145, {
const chart1720073104226 = new Chart(ctx1720073104226, {
type: 'bar',
data: {
labels: ["send 1KiB of data over ws"],
datasets: [
{
data: [83129],
data: [72202],
backgroundColor: ["hsl(120, 85%, 55%)"],
borderColor: ["hsl(120, 85%, 55%)"],
borderWidth: 2,
Expand Down
Loading

0 comments on commit abbdf53

Please sign in to comment.