overtake 1.3.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -15
- package/bin/overtake.js +1 -1
- package/build/executor.d.ts +8 -3
- package/build/index.d.ts +10 -11
- package/build/reporter.d.ts +10 -2
- package/build/runner.d.ts +1 -1
- package/build/types.d.ts +7 -7
- package/build/utils.d.ts +3 -17
- package/package.json +8 -26
- package/src/__tests__/assert-no-closure.ts +135 -0
- package/src/__tests__/benchmark-execute.ts +48 -0
- package/src/cli.ts +139 -144
- package/src/executor.ts +59 -24
- package/src/index.ts +135 -68
- package/src/reporter.ts +77 -125
- package/src/runner.ts +28 -25
- package/src/types.ts +9 -9
- package/src/utils.ts +62 -46
- package/src/worker.ts +13 -12
- package/tsconfig.json +3 -1
- package/build/cli.cjs +0 -179
- package/build/cli.cjs.map +0 -1
- package/build/cli.js +0 -134
- package/build/cli.js.map +0 -1
- package/build/executor.cjs +0 -116
- package/build/executor.cjs.map +0 -1
- package/build/executor.js +0 -106
- package/build/executor.js.map +0 -1
- package/build/gc-watcher.cjs +0 -30
- package/build/gc-watcher.cjs.map +0 -1
- package/build/gc-watcher.js +0 -20
- package/build/gc-watcher.js.map +0 -1
- package/build/index.cjs +0 -400
- package/build/index.cjs.map +0 -1
- package/build/index.js +0 -335
- package/build/index.js.map +0 -1
- package/build/reporter.cjs +0 -364
- package/build/reporter.cjs.map +0 -1
- package/build/reporter.js +0 -346
- package/build/reporter.js.map +0 -1
- package/build/runner.cjs +0 -528
- package/build/runner.cjs.map +0 -1
- package/build/runner.js +0 -518
- package/build/runner.js.map +0 -1
- package/build/types.cjs +0 -66
- package/build/types.cjs.map +0 -1
- package/build/types.js +0 -33
- package/build/types.js.map +0 -1
- package/build/utils.cjs +0 -121
- package/build/utils.cjs.map +0 -1
- package/build/utils.js +0 -85
- package/build/utils.js.map +0 -1
- package/build/worker.cjs +0 -158
- package/build/worker.cjs.map +0 -1
- package/build/worker.js +0 -113
- package/build/worker.js.map +0 -1
package/build/types.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["export type MaybePromise<T> = Promise<T> | PromiseLike<T> | T;\n\nexport interface SetupFn<TContext> {\n (): MaybePromise<TContext>;\n}\n\nexport interface TeardownFn<TContext> {\n (ctx: TContext): MaybePromise<void>;\n}\n\nexport interface StepFn<TContext, TInput> {\n (ctx: TContext, input: TInput): MaybePromise<unknown>;\n}\n\nexport interface FeedFn<TInput> {\n (): MaybePromise<TInput>;\n}\n\ntype _Sequence<To extends number, R extends unknown[]> = R['length'] extends To ? R[number] : _Sequence<To, [R['length'], ...R]>;\nexport type Sequence<To extends number> = number extends To ? number : _Sequence<To, []>;\nexport type Between<From extends number, To extends number> = Exclude<Sequence<To>, Sequence<From>>;\n\nexport type ReportType =\n | 'ops'\n | 'min'\n | 'max'\n | 'mean'\n | 'median'\n | 'mode'\n | 'variance'\n | 'sd'\n | 'sem'\n | 'moe'\n | 'rme'\n | 'mad'\n | 'iqr'\n | 'ci_lower'\n | 'ci_upper'\n | `p${Between<1, 100>}`;\nexport type ReportTypeList = readonly ReportType[];\nexport const REPORT_TYPES: ReportTypeList = Array.from({ length: 99 }, (_, idx) => `p${idx + 1}` as ReportType).concat([\n 'ops',\n 'mean',\n 'min',\n 'max',\n 'median',\n 'mode',\n 'variance',\n 'sd',\n 'sem',\n 'moe',\n 'rme',\n 'mad',\n 'iqr',\n 'ci_lower',\n 'ci_upper',\n]);\n\nexport interface ReportOptions<R extends ReportTypeList> {\n reportTypes: R;\n}\n\nexport interface BenchmarkOptions {\n warmupCycles?: number;\n minCycles?: number;\n absThreshold?: number; // ns\n relThreshold?: number; // %\n gcObserver?: boolean;\n}\n\nexport interface RunOptions<TContext, TInput> {\n setup?: SetupFn<TContext>;\n teardown?: TeardownFn<TContext>;\n pre?: StepFn<TContext, TInput>;\n run: StepFn<TContext, TInput>;\n post?: StepFn<TContext, TInput>;\n data?: TInput;\n}\n\nexport interface ExecutorRunOptions<TContext, TInput> extends RunOptions<TContext, TInput> {\n id?: string;\n}\n\nexport interface WorkerOptions extends Required<BenchmarkOptions> {\n benchmarkUrl?: string;\n setupCode?: string;\n teardownCode?: string;\n preCode?: string;\n runCode: string;\n postCode?: string;\n data?: unknown;\n\n durationsSAB: SharedArrayBuffer;\n controlSAB: SharedArrayBuffer;\n}\n\nexport interface Options<TContext, TInput> extends RunOptions<TContext, TInput>, BenchmarkOptions {\n durationsSAB: SharedArrayBuffer;\n controlSAB: SharedArrayBuffer;\n}\n\nexport enum Control {\n INDEX,\n PROGRESS,\n COMPLETE,\n HEAP_USED,\n}\n\nexport const CONTROL_SLOTS = Object.values(Control).length / 2;\nexport const DEFAULT_CYCLES = 1_000;\nexport const Z95 = 1.96;\nexport const DURATION_SCALE = 1000n;\nexport const COMPLETE_VALUE = 100_00;\n\nexport interface ProgressInfo {\n id: string;\n progress: number;\n}\n\nexport type ProgressCallback = (info: ProgressInfo) => void;\n"],"names":["COMPLETE_VALUE","CONTROL_SLOTS","Control","DEFAULT_CYCLES","DURATION_SCALE","REPORT_TYPES","Z95","Array","from","length","_","idx","concat","Object","values"],"mappings":";;;;;;;;;;;QAgHaA;eAAAA;;QAJAC;eAAAA;;QAPDC;eAAAA;;QAQCC;eAAAA;;QAEAC;eAAAA;;QAvEAC;eAAAA;;QAsEAC;eAAAA;;;AAtEN,MAAMD,eAA+BE,MAAMC,IAAI,CAAC;IAAEC,QAAQ;AAAG,GAAG,CAACC,GAAGC,MAAQ,CAAC,CAAC,EAAEA,MAAM,GAAG,EAAgBC,MAAM,CAAC;IACrH;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AA6CM,IAAA,AAAKV,iCAAAA;;;;;WAAAA;;AAOL,MAAMD,gBAAgBY,OAAOC,MAAM,CAACZ,SAASO,MAAM,GAAG;AACtD,MAAMN,iBAAiB;AACvB,MAAMG,MAAM;AACZ,MAAMF,iBAAiB,KAAK;AAC5B,MAAMJ,iBAAiB"}
|
package/build/types.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export const REPORT_TYPES = Array.from({
|
|
2
|
-
length: 99
|
|
3
|
-
}, (_, idx)=>`p${idx + 1}`).concat([
|
|
4
|
-
'ops',
|
|
5
|
-
'mean',
|
|
6
|
-
'min',
|
|
7
|
-
'max',
|
|
8
|
-
'median',
|
|
9
|
-
'mode',
|
|
10
|
-
'variance',
|
|
11
|
-
'sd',
|
|
12
|
-
'sem',
|
|
13
|
-
'moe',
|
|
14
|
-
'rme',
|
|
15
|
-
'mad',
|
|
16
|
-
'iqr',
|
|
17
|
-
'ci_lower',
|
|
18
|
-
'ci_upper'
|
|
19
|
-
]);
|
|
20
|
-
export var Control = /*#__PURE__*/ function(Control) {
|
|
21
|
-
Control[Control["INDEX"] = 0] = "INDEX";
|
|
22
|
-
Control[Control["PROGRESS"] = 1] = "PROGRESS";
|
|
23
|
-
Control[Control["COMPLETE"] = 2] = "COMPLETE";
|
|
24
|
-
Control[Control["HEAP_USED"] = 3] = "HEAP_USED";
|
|
25
|
-
return Control;
|
|
26
|
-
}({});
|
|
27
|
-
export const CONTROL_SLOTS = Object.values(Control).length / 2;
|
|
28
|
-
export const DEFAULT_CYCLES = 1_000;
|
|
29
|
-
export const Z95 = 1.96;
|
|
30
|
-
export const DURATION_SCALE = 1000n;
|
|
31
|
-
export const COMPLETE_VALUE = 100_00;
|
|
32
|
-
|
|
33
|
-
//# sourceMappingURL=types.js.map
|
package/build/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["export type MaybePromise<T> = Promise<T> | PromiseLike<T> | T;\n\nexport interface SetupFn<TContext> {\n (): MaybePromise<TContext>;\n}\n\nexport interface TeardownFn<TContext> {\n (ctx: TContext): MaybePromise<void>;\n}\n\nexport interface StepFn<TContext, TInput> {\n (ctx: TContext, input: TInput): MaybePromise<unknown>;\n}\n\nexport interface FeedFn<TInput> {\n (): MaybePromise<TInput>;\n}\n\ntype _Sequence<To extends number, R extends unknown[]> = R['length'] extends To ? R[number] : _Sequence<To, [R['length'], ...R]>;\nexport type Sequence<To extends number> = number extends To ? number : _Sequence<To, []>;\nexport type Between<From extends number, To extends number> = Exclude<Sequence<To>, Sequence<From>>;\n\nexport type ReportType =\n | 'ops'\n | 'min'\n | 'max'\n | 'mean'\n | 'median'\n | 'mode'\n | 'variance'\n | 'sd'\n | 'sem'\n | 'moe'\n | 'rme'\n | 'mad'\n | 'iqr'\n | 'ci_lower'\n | 'ci_upper'\n | `p${Between<1, 100>}`;\nexport type ReportTypeList = readonly ReportType[];\nexport const REPORT_TYPES: ReportTypeList = Array.from({ length: 99 }, (_, idx) => `p${idx + 1}` as ReportType).concat([\n 'ops',\n 'mean',\n 'min',\n 'max',\n 'median',\n 'mode',\n 'variance',\n 'sd',\n 'sem',\n 'moe',\n 'rme',\n 'mad',\n 'iqr',\n 'ci_lower',\n 'ci_upper',\n]);\n\nexport interface ReportOptions<R extends ReportTypeList> {\n reportTypes: R;\n}\n\nexport interface BenchmarkOptions {\n warmupCycles?: number;\n minCycles?: number;\n absThreshold?: number; // ns\n relThreshold?: number; // %\n gcObserver?: boolean;\n}\n\nexport interface RunOptions<TContext, TInput> {\n setup?: SetupFn<TContext>;\n teardown?: TeardownFn<TContext>;\n pre?: StepFn<TContext, TInput>;\n run: StepFn<TContext, TInput>;\n post?: StepFn<TContext, TInput>;\n data?: TInput;\n}\n\nexport interface ExecutorRunOptions<TContext, TInput> extends RunOptions<TContext, TInput> {\n id?: string;\n}\n\nexport interface WorkerOptions extends Required<BenchmarkOptions> {\n benchmarkUrl?: string;\n setupCode?: string;\n teardownCode?: string;\n preCode?: string;\n runCode: string;\n postCode?: string;\n data?: unknown;\n\n durationsSAB: SharedArrayBuffer;\n controlSAB: SharedArrayBuffer;\n}\n\nexport interface Options<TContext, TInput> extends RunOptions<TContext, TInput>, BenchmarkOptions {\n durationsSAB: SharedArrayBuffer;\n controlSAB: SharedArrayBuffer;\n}\n\nexport enum Control {\n INDEX,\n PROGRESS,\n COMPLETE,\n HEAP_USED,\n}\n\nexport const CONTROL_SLOTS = Object.values(Control).length / 2;\nexport const DEFAULT_CYCLES = 1_000;\nexport const Z95 = 1.96;\nexport const DURATION_SCALE = 1000n;\nexport const COMPLETE_VALUE = 100_00;\n\nexport interface ProgressInfo {\n id: string;\n progress: number;\n}\n\nexport type ProgressCallback = (info: ProgressInfo) => void;\n"],"names":["REPORT_TYPES","Array","from","length","_","idx","concat","Control","CONTROL_SLOTS","Object","values","DEFAULT_CYCLES","Z95","DURATION_SCALE","COMPLETE_VALUE"],"mappings":"AAwCA,OAAO,MAAMA,eAA+BC,MAAMC,IAAI,CAAC;IAAEC,QAAQ;AAAG,GAAG,CAACC,GAAGC,MAAQ,CAAC,CAAC,EAAEA,MAAM,GAAG,EAAgBC,MAAM,CAAC;IACrH;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,EAAE;AA6CH,OAAO,IAAA,AAAKC,iCAAAA;;;;;WAAAA;MAKX;AAED,OAAO,MAAMC,gBAAgBC,OAAOC,MAAM,CAACH,SAASJ,MAAM,GAAG,EAAE;AAC/D,OAAO,MAAMQ,iBAAiB,MAAM;AACpC,OAAO,MAAMC,MAAM,KAAK;AACxB,OAAO,MAAMC,iBAAiB,KAAK,CAAC;AACpC,OAAO,MAAMC,iBAAiB,OAAO"}
|
package/build/utils.cjs
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
get ScaledBigInt () {
|
|
13
|
-
return ScaledBigInt;
|
|
14
|
-
},
|
|
15
|
-
get abs () {
|
|
16
|
-
return abs;
|
|
17
|
-
},
|
|
18
|
-
get cmp () {
|
|
19
|
-
return cmp;
|
|
20
|
-
},
|
|
21
|
-
get div () {
|
|
22
|
-
return div;
|
|
23
|
-
},
|
|
24
|
-
get divMod () {
|
|
25
|
-
return divMod;
|
|
26
|
-
},
|
|
27
|
-
get divs () {
|
|
28
|
-
return divs;
|
|
29
|
-
},
|
|
30
|
-
get max () {
|
|
31
|
-
return max;
|
|
32
|
-
},
|
|
33
|
-
get transpile () {
|
|
34
|
-
return transpile;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
const _core = require("@swc/core");
|
|
38
|
-
const abs = (value)=>{
|
|
39
|
-
if (value < 0n) {
|
|
40
|
-
return -value;
|
|
41
|
-
}
|
|
42
|
-
return value;
|
|
43
|
-
};
|
|
44
|
-
const cmp = (a, b)=>{
|
|
45
|
-
if (a > b) {
|
|
46
|
-
return 1;
|
|
47
|
-
}
|
|
48
|
-
if (a < b) {
|
|
49
|
-
return -1;
|
|
50
|
-
}
|
|
51
|
-
return 0;
|
|
52
|
-
};
|
|
53
|
-
const max = (a, b)=>{
|
|
54
|
-
if (a > b) {
|
|
55
|
-
return a;
|
|
56
|
-
}
|
|
57
|
-
return b;
|
|
58
|
-
};
|
|
59
|
-
const divMod = (a, b)=>{
|
|
60
|
-
return {
|
|
61
|
-
quotient: a / b,
|
|
62
|
-
remainder: a % b
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
function div(a, b, decimals = 2) {
|
|
66
|
-
if (b === 0n) throw new RangeError('Division by zero');
|
|
67
|
-
const scale = 10n ** BigInt(decimals);
|
|
68
|
-
const scaled = a * scale / b;
|
|
69
|
-
const intPart = scaled / scale;
|
|
70
|
-
const fracPart = scaled % scale;
|
|
71
|
-
return `${intPart}.${fracPart.toString().padStart(decimals, '0')}`;
|
|
72
|
-
}
|
|
73
|
-
function divs(a, b, scale) {
|
|
74
|
-
if (b === 0n) throw new RangeError('Division by zero');
|
|
75
|
-
return a * scale / b;
|
|
76
|
-
}
|
|
77
|
-
class ScaledBigInt {
|
|
78
|
-
value;
|
|
79
|
-
scale;
|
|
80
|
-
constructor(value, scale){
|
|
81
|
-
this.value = value;
|
|
82
|
-
this.scale = scale;
|
|
83
|
-
}
|
|
84
|
-
add(value) {
|
|
85
|
-
this.value += value * this.scale;
|
|
86
|
-
}
|
|
87
|
-
sub(value) {
|
|
88
|
-
this.value -= value * this.scale;
|
|
89
|
-
}
|
|
90
|
-
div(value) {
|
|
91
|
-
this.value /= value;
|
|
92
|
-
}
|
|
93
|
-
mul(value) {
|
|
94
|
-
this.value *= value;
|
|
95
|
-
}
|
|
96
|
-
unscale() {
|
|
97
|
-
return this.value / this.scale;
|
|
98
|
-
}
|
|
99
|
-
number() {
|
|
100
|
-
return Number(div(this.value, this.scale));
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
const transpile = async (code)=>{
|
|
104
|
-
const output = await (0, _core.transform)(code, {
|
|
105
|
-
filename: 'benchmark.ts',
|
|
106
|
-
jsc: {
|
|
107
|
-
parser: {
|
|
108
|
-
syntax: 'typescript',
|
|
109
|
-
tsx: false,
|
|
110
|
-
dynamicImport: true
|
|
111
|
-
},
|
|
112
|
-
target: 'esnext'
|
|
113
|
-
},
|
|
114
|
-
module: {
|
|
115
|
-
type: 'es6'
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
return output.code;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
//# sourceMappingURL=utils.cjs.map
|
package/build/utils.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils.ts"],"sourcesContent":["import { transform } from '@swc/core';\n\nexport const abs = (value: bigint) => {\n if (value < 0n) {\n return -value;\n }\n return value;\n};\nexport const cmp = (a: bigint | number, b: bigint | number): number => {\n if (a > b) {\n return 1;\n }\n if (a < b) {\n return -1;\n }\n return 0;\n};\n\nexport const max = (a: bigint, b: bigint) => {\n if (a > b) {\n return a;\n }\n return b;\n};\n\nexport const divMod = (a: bigint, b: bigint) => {\n return { quotient: a / b, remainder: a % b };\n};\n\nexport function div(a: bigint, b: bigint, decimals: number = 2): string {\n if (b === 0n) throw new RangeError('Division by zero');\n const scale = 10n ** BigInt(decimals);\n const scaled = (a * scale) / b;\n const intPart = scaled / scale;\n const fracPart = scaled % scale;\n return `${intPart}.${fracPart.toString().padStart(decimals, '0')}`;\n}\n\nexport function divs(a: bigint, b: bigint, scale: bigint): bigint {\n if (b === 0n) throw new RangeError('Division by zero');\n return (a * scale) / b;\n}\n\nexport class ScaledBigInt {\n constructor(\n public value: bigint,\n public scale: bigint,\n ) {}\n add(value: bigint) {\n this.value += value * this.scale;\n }\n sub(value: bigint) {\n this.value -= value * this.scale;\n }\n div(value: bigint) {\n this.value /= value;\n }\n mul(value: bigint) {\n this.value *= value;\n }\n unscale() {\n return this.value / this.scale;\n }\n number() {\n return Number(div(this.value, this.scale));\n }\n}\n\nexport const transpile = async (code: string): Promise<string> => {\n const output = await transform(code, {\n filename: 'benchmark.ts',\n jsc: {\n parser: {\n syntax: 'typescript',\n tsx: false,\n dynamicImport: true,\n },\n target: 'esnext',\n },\n module: {\n type: 'es6',\n },\n });\n return output.code;\n};\n"],"names":["ScaledBigInt","abs","cmp","div","divMod","divs","max","transpile","value","a","b","quotient","remainder","decimals","RangeError","scale","BigInt","scaled","intPart","fracPart","toString","padStart","add","sub","mul","unscale","number","Number","code","output","transform","filename","jsc","parser","syntax","tsx","dynamicImport","target","module","type"],"mappings":";;;;;;;;;;;QA2CaA;eAAAA;;QAzCAC;eAAAA;;QAMAC;eAAAA;;QAqBGC;eAAAA;;QAJHC;eAAAA;;QAaGC;eAAAA;;QApBHC;eAAAA;;QAkDAC;eAAAA;;;sBApEa;AAE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AChB;IACAgB,IAAIhB,KAAa,EAAE;QACjB,IAAI,CAACA,KAAK,IAAIA;IAChB;IACAiB,UAAU;QACR,OAAO,IAAI,CAACjB,KAAK,GAAG,IAAI,CAACO,KAAK;IAChC;IACAW,SAAS;QACP,OAAOC,OAAOxB,IAAI,IAAI,CAACK,KAAK,EAAE,IAAI,CAACO,KAAK;IAC1C;AACF;AAEO,MAAMR,YAAY,OAAOqB;IAC9B,MAAMC,SAAS,MAAMC,IAAAA,eAAS,EAACF,MAAM;QACnCG,UAAU;QACVC,KAAK;YACHC,QAAQ;gBACNC,QAAQ;gBACRC,KAAK;gBACLC,eAAe;YACjB;YACAC,QAAQ;QACV;QACAC,QAAQ;YACNC,MAAM;QACR;IACF;IACA,OAAOV,OAAOD,IAAI;AACpB"}
|
package/build/utils.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { transform } from '@swc/core';
|
|
2
|
-
export const abs = (value)=>{
|
|
3
|
-
if (value < 0n) {
|
|
4
|
-
return -value;
|
|
5
|
-
}
|
|
6
|
-
return value;
|
|
7
|
-
};
|
|
8
|
-
export const cmp = (a, b)=>{
|
|
9
|
-
if (a > b) {
|
|
10
|
-
return 1;
|
|
11
|
-
}
|
|
12
|
-
if (a < b) {
|
|
13
|
-
return -1;
|
|
14
|
-
}
|
|
15
|
-
return 0;
|
|
16
|
-
};
|
|
17
|
-
export const max = (a, b)=>{
|
|
18
|
-
if (a > b) {
|
|
19
|
-
return a;
|
|
20
|
-
}
|
|
21
|
-
return b;
|
|
22
|
-
};
|
|
23
|
-
export const divMod = (a, b)=>{
|
|
24
|
-
return {
|
|
25
|
-
quotient: a / b,
|
|
26
|
-
remainder: a % b
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
export function div(a, b, decimals = 2) {
|
|
30
|
-
if (b === 0n) throw new RangeError('Division by zero');
|
|
31
|
-
const scale = 10n ** BigInt(decimals);
|
|
32
|
-
const scaled = a * scale / b;
|
|
33
|
-
const intPart = scaled / scale;
|
|
34
|
-
const fracPart = scaled % scale;
|
|
35
|
-
return `${intPart}.${fracPart.toString().padStart(decimals, '0')}`;
|
|
36
|
-
}
|
|
37
|
-
export function divs(a, b, scale) {
|
|
38
|
-
if (b === 0n) throw new RangeError('Division by zero');
|
|
39
|
-
return a * scale / b;
|
|
40
|
-
}
|
|
41
|
-
export class ScaledBigInt {
|
|
42
|
-
value;
|
|
43
|
-
scale;
|
|
44
|
-
constructor(value, scale){
|
|
45
|
-
this.value = value;
|
|
46
|
-
this.scale = scale;
|
|
47
|
-
}
|
|
48
|
-
add(value) {
|
|
49
|
-
this.value += value * this.scale;
|
|
50
|
-
}
|
|
51
|
-
sub(value) {
|
|
52
|
-
this.value -= value * this.scale;
|
|
53
|
-
}
|
|
54
|
-
div(value) {
|
|
55
|
-
this.value /= value;
|
|
56
|
-
}
|
|
57
|
-
mul(value) {
|
|
58
|
-
this.value *= value;
|
|
59
|
-
}
|
|
60
|
-
unscale() {
|
|
61
|
-
return this.value / this.scale;
|
|
62
|
-
}
|
|
63
|
-
number() {
|
|
64
|
-
return Number(div(this.value, this.scale));
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
export const transpile = async (code)=>{
|
|
68
|
-
const output = await transform(code, {
|
|
69
|
-
filename: 'benchmark.ts',
|
|
70
|
-
jsc: {
|
|
71
|
-
parser: {
|
|
72
|
-
syntax: 'typescript',
|
|
73
|
-
tsx: false,
|
|
74
|
-
dynamicImport: true
|
|
75
|
-
},
|
|
76
|
-
target: 'esnext'
|
|
77
|
-
},
|
|
78
|
-
module: {
|
|
79
|
-
type: 'es6'
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
return output.code;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
//# sourceMappingURL=utils.js.map
|
package/build/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils.ts"],"sourcesContent":["import { transform } from '@swc/core';\n\nexport const abs = (value: bigint) => {\n if (value < 0n) {\n return -value;\n }\n return value;\n};\nexport const cmp = (a: bigint | number, b: bigint | number): number => {\n if (a > b) {\n return 1;\n }\n if (a < b) {\n return -1;\n }\n return 0;\n};\n\nexport const max = (a: bigint, b: bigint) => {\n if (a > b) {\n return a;\n }\n return b;\n};\n\nexport const divMod = (a: bigint, b: bigint) => {\n return { quotient: a / b, remainder: a % b };\n};\n\nexport function div(a: bigint, b: bigint, decimals: number = 2): string {\n if (b === 0n) throw new RangeError('Division by zero');\n const scale = 10n ** BigInt(decimals);\n const scaled = (a * scale) / b;\n const intPart = scaled / scale;\n const fracPart = scaled % scale;\n return `${intPart}.${fracPart.toString().padStart(decimals, '0')}`;\n}\n\nexport function divs(a: bigint, b: bigint, scale: bigint): bigint {\n if (b === 0n) throw new RangeError('Division by zero');\n return (a * scale) / b;\n}\n\nexport class ScaledBigInt {\n constructor(\n public value: bigint,\n public scale: bigint,\n ) {}\n add(value: bigint) {\n this.value += value * this.scale;\n }\n sub(value: bigint) {\n this.value -= value * this.scale;\n }\n div(value: bigint) {\n this.value /= value;\n }\n mul(value: bigint) {\n this.value *= value;\n }\n unscale() {\n return this.value / this.scale;\n }\n number() {\n return Number(div(this.value, this.scale));\n }\n}\n\nexport const transpile = async (code: string): Promise<string> => {\n const output = await transform(code, {\n filename: 'benchmark.ts',\n jsc: {\n parser: {\n syntax: 'typescript',\n tsx: false,\n dynamicImport: true,\n },\n target: 'esnext',\n },\n module: {\n type: 'es6',\n },\n });\n return output.code;\n};\n"],"names":["transform","abs","value","cmp","a","b","max","divMod","quotient","remainder","div","decimals","RangeError","scale","BigInt","scaled","intPart","fracPart","toString","padStart","divs","ScaledBigInt","add","sub","mul","unscale","number","Number","transpile","code","output","filename","jsc","parser","syntax","tsx","dynamicImport","target","module","type"],"mappings":"AAAA,SAASA,SAAS,QAAQ,YAAY;AAEtC,OAAO,MAAMC,MAAM,CAACC;IAClB,IAAIA,QAAQ,EAAE,EAAE;QACd,OAAO,CAACA;IACV;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IAAItB,KAAa,EAAE;QACjB,IAAI,CAACA,KAAK,IAAIA;IAChB;IACAuB,UAAU;QACR,OAAO,IAAI,CAACvB,KAAK,GAAG,IAAI,CAACW,KAAK;IAChC;IACAa,SAAS;QACP,OAAOC,OAAOjB,IAAI,IAAI,CAACR,KAAK,EAAE,IAAI,CAACW,KAAK;IAC1C;AACF;AAEA,OAAO,MAAMe,YAAY,OAAOC;IAC9B,MAAMC,SAAS,MAAM9B,UAAU6B,MAAM;QACnCE,UAAU;QACVC,KAAK;YACHC,QAAQ;gBACNC,QAAQ;gBACRC,KAAK;gBACLC,eAAe;YACjB;YACAC,QAAQ;QACV;QACAC,QAAQ;YACNC,MAAM;QACR;IACF;IACA,OAAOT,OAAOD,IAAI;AACpB,EAAE"}
|
package/build/worker.cjs
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
const _nodeworker_threads = require("node:worker_threads");
|
|
6
|
-
const _nodevm = require("node:vm");
|
|
7
|
-
const _nodemodule = require("node:module");
|
|
8
|
-
const _nodepath = require("node:path");
|
|
9
|
-
const _nodeurl = require("node:url");
|
|
10
|
-
const _runnercjs = require("./runner.cjs");
|
|
11
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
12
|
-
if (typeof WeakMap !== "function") return null;
|
|
13
|
-
var cacheBabelInterop = new WeakMap();
|
|
14
|
-
var cacheNodeInterop = new WeakMap();
|
|
15
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
16
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
17
|
-
})(nodeInterop);
|
|
18
|
-
}
|
|
19
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
20
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
21
|
-
return obj;
|
|
22
|
-
}
|
|
23
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
24
|
-
return {
|
|
25
|
-
default: obj
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
29
|
-
if (cache && cache.has(obj)) {
|
|
30
|
-
return cache.get(obj);
|
|
31
|
-
}
|
|
32
|
-
var newObj = {
|
|
33
|
-
__proto__: null
|
|
34
|
-
};
|
|
35
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
36
|
-
for(var key in obj){
|
|
37
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
38
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
39
|
-
if (desc && (desc.get || desc.set)) {
|
|
40
|
-
Object.defineProperty(newObj, key, desc);
|
|
41
|
-
} else {
|
|
42
|
-
newObj[key] = obj[key];
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
newObj.default = obj;
|
|
47
|
-
if (cache) {
|
|
48
|
-
cache.set(obj, newObj);
|
|
49
|
-
}
|
|
50
|
-
return newObj;
|
|
51
|
-
}
|
|
52
|
-
const { benchmarkUrl, setupCode, teardownCode, preCode, runCode, postCode, data, warmupCycles, minCycles, absThreshold, relThreshold, gcObserver = true, durationsSAB, controlSAB } = _nodeworker_threads.workerData;
|
|
53
|
-
const serialize = (code)=>code ? code : 'undefined';
|
|
54
|
-
const resolvedBenchmarkUrl = typeof benchmarkUrl === 'string' ? benchmarkUrl : (0, _nodeurl.pathToFileURL)(process.cwd()).href;
|
|
55
|
-
const benchmarkDirUrl = new URL('.', resolvedBenchmarkUrl).href;
|
|
56
|
-
const requireFrom = (0, _nodemodule.createRequire)((0, _nodeurl.fileURLToPath)(new URL('benchmark.js', benchmarkDirUrl)));
|
|
57
|
-
const resolveSpecifier = (specifier)=>{
|
|
58
|
-
if (specifier.startsWith('file:')) {
|
|
59
|
-
return specifier;
|
|
60
|
-
}
|
|
61
|
-
if (specifier.startsWith('./') || specifier.startsWith('../')) {
|
|
62
|
-
return new URL(specifier, benchmarkDirUrl).href;
|
|
63
|
-
}
|
|
64
|
-
if ((0, _nodepath.isAbsolute)(specifier)) {
|
|
65
|
-
return (0, _nodeurl.pathToFileURL)(specifier).href;
|
|
66
|
-
}
|
|
67
|
-
return requireFrom.resolve(specifier);
|
|
68
|
-
};
|
|
69
|
-
const source = `
|
|
70
|
-
export const setup = ${serialize(setupCode)};
|
|
71
|
-
export const teardown = ${serialize(teardownCode)};
|
|
72
|
-
export const pre = ${serialize(preCode)};
|
|
73
|
-
export const run = ${serialize(runCode)};
|
|
74
|
-
export const post = ${serialize(postCode)};
|
|
75
|
-
`;
|
|
76
|
-
const globals = Object.create(null);
|
|
77
|
-
for (const k of Object.getOwnPropertyNames(globalThis)){
|
|
78
|
-
globals[k] = globalThis[k];
|
|
79
|
-
}
|
|
80
|
-
const context = (0, _nodevm.createContext)(globals);
|
|
81
|
-
const imports = new Map();
|
|
82
|
-
const createSyntheticModule = (moduleExports, exportNames, identifier)=>{
|
|
83
|
-
const mod = new _nodevm.SyntheticModule(exportNames, ()=>{
|
|
84
|
-
for (const name of exportNames){
|
|
85
|
-
if (name === 'default') {
|
|
86
|
-
mod.setExport(name, moduleExports);
|
|
87
|
-
continue;
|
|
88
|
-
}
|
|
89
|
-
mod.setExport(name, moduleExports[name]);
|
|
90
|
-
}
|
|
91
|
-
}, {
|
|
92
|
-
identifier,
|
|
93
|
-
context
|
|
94
|
-
});
|
|
95
|
-
return mod;
|
|
96
|
-
};
|
|
97
|
-
const isCjsModule = (target)=>target.endsWith('.cjs') || target.endsWith('.cts');
|
|
98
|
-
const toRequireTarget = (target)=>target.startsWith('file:') ? (0, _nodeurl.fileURLToPath)(target) : target;
|
|
99
|
-
const loadModule = async (target)=>{
|
|
100
|
-
const cached = imports.get(target);
|
|
101
|
-
if (cached) return cached;
|
|
102
|
-
if (isCjsModule(target)) {
|
|
103
|
-
const required = requireFrom(toRequireTarget(target));
|
|
104
|
-
const exportNames = required && (typeof required === 'object' || typeof required === 'function') ? Object.keys(required) : [];
|
|
105
|
-
if (!exportNames.includes('default')) {
|
|
106
|
-
exportNames.push('default');
|
|
107
|
-
}
|
|
108
|
-
const mod = createSyntheticModule(required, exportNames, target);
|
|
109
|
-
imports.set(target, mod);
|
|
110
|
-
return mod;
|
|
111
|
-
}
|
|
112
|
-
const importedModule = await Promise.resolve(target).then((p)=>/*#__PURE__*/ _interop_require_wildcard(require(p)));
|
|
113
|
-
const exportNames = Object.keys(importedModule);
|
|
114
|
-
const mod = createSyntheticModule(importedModule, exportNames, target);
|
|
115
|
-
imports.set(target, mod);
|
|
116
|
-
return mod;
|
|
117
|
-
};
|
|
118
|
-
const loadDynamicModule = async (target)=>{
|
|
119
|
-
const mod = await loadModule(target);
|
|
120
|
-
if (mod.status !== 'evaluated') {
|
|
121
|
-
await mod.evaluate();
|
|
122
|
-
}
|
|
123
|
-
return mod;
|
|
124
|
-
};
|
|
125
|
-
const mod = new _nodevm.SourceTextModule(source, {
|
|
126
|
-
identifier: resolvedBenchmarkUrl,
|
|
127
|
-
context,
|
|
128
|
-
initializeImportMeta (meta) {
|
|
129
|
-
meta.url = resolvedBenchmarkUrl;
|
|
130
|
-
},
|
|
131
|
-
importModuleDynamically (specifier) {
|
|
132
|
-
const resolved = resolveSpecifier(specifier);
|
|
133
|
-
return loadDynamicModule(resolved);
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
await mod.link(async (specifier)=>loadModule(resolveSpecifier(specifier)));
|
|
137
|
-
await mod.evaluate();
|
|
138
|
-
const { setup, teardown, pre, run, post } = mod.namespace;
|
|
139
|
-
if (!run) {
|
|
140
|
-
throw new Error('Benchmark run function is required');
|
|
141
|
-
}
|
|
142
|
-
process.exitCode = await (0, _runnercjs.benchmark)({
|
|
143
|
-
setup,
|
|
144
|
-
teardown,
|
|
145
|
-
pre,
|
|
146
|
-
run,
|
|
147
|
-
post,
|
|
148
|
-
data,
|
|
149
|
-
warmupCycles,
|
|
150
|
-
minCycles,
|
|
151
|
-
absThreshold,
|
|
152
|
-
relThreshold,
|
|
153
|
-
gcObserver,
|
|
154
|
-
durationsSAB,
|
|
155
|
-
controlSAB
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
//# sourceMappingURL=worker.cjs.map
|
package/build/worker.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/worker.ts"],"sourcesContent":["import { workerData } from 'node:worker_threads';\nimport { SourceTextModule, SyntheticModule, createContext } from 'node:vm';\nimport { createRequire } from 'node:module';\nimport { isAbsolute } from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport { benchmark } from './runner.js';\nimport { WorkerOptions } from './types.js';\n\nconst {\n benchmarkUrl,\n setupCode,\n teardownCode,\n preCode,\n runCode,\n postCode,\n data,\n\n warmupCycles,\n minCycles,\n absThreshold,\n relThreshold,\n gcObserver = true,\n\n durationsSAB,\n controlSAB,\n}: WorkerOptions = workerData;\n\nconst serialize = (code?: string) => (code ? code : 'undefined');\n\nconst resolvedBenchmarkUrl = typeof benchmarkUrl === 'string' ? benchmarkUrl : pathToFileURL(process.cwd()).href;\nconst benchmarkDirUrl = new URL('.', resolvedBenchmarkUrl).href;\nconst requireFrom = createRequire(fileURLToPath(new URL('benchmark.js', benchmarkDirUrl)));\n\nconst resolveSpecifier = (specifier: string) => {\n if (specifier.startsWith('file:')) {\n return specifier;\n }\n if (specifier.startsWith('./') || specifier.startsWith('../')) {\n return new URL(specifier, benchmarkDirUrl).href;\n }\n if (isAbsolute(specifier)) {\n return pathToFileURL(specifier).href;\n }\n return requireFrom.resolve(specifier);\n};\n\nconst source = `\nexport const setup = ${serialize(setupCode)};\nexport const teardown = ${serialize(teardownCode)};\nexport const pre = ${serialize(preCode)};\nexport const run = ${serialize(runCode)};\nexport const post = ${serialize(postCode)};\n `;\n\nconst globals = Object.create(null);\nfor (const k of Object.getOwnPropertyNames(globalThis)) {\n globals[k] = (globalThis as any)[k];\n}\nconst context = createContext(globals);\nconst imports = new Map<string, SyntheticModule>();\n\nconst createSyntheticModule = (moduleExports: unknown, exportNames: string[], identifier: string) => {\n const mod = new SyntheticModule(\n exportNames,\n () => {\n for (const name of exportNames) {\n if (name === 'default') {\n mod.setExport(name, moduleExports);\n continue;\n }\n mod.setExport(name, (moduleExports as Record<string, unknown>)[name]);\n }\n },\n { identifier, context },\n );\n return mod;\n};\n\nconst isCjsModule = (target: string) => target.endsWith('.cjs') || target.endsWith('.cts');\n\nconst toRequireTarget = (target: string) => (target.startsWith('file:') ? fileURLToPath(target) : target);\n\nconst loadModule = async (target: string) => {\n const cached = imports.get(target);\n if (cached) return cached;\n\n if (isCjsModule(target)) {\n const required = requireFrom(toRequireTarget(target));\n const exportNames = required && (typeof required === 'object' || typeof required === 'function') ? Object.keys(required) : [];\n if (!exportNames.includes('default')) {\n exportNames.push('default');\n }\n const mod = createSyntheticModule(required, exportNames, target);\n imports.set(target, mod);\n return mod;\n }\n\n const importedModule = await import(target);\n const exportNames = Object.keys(importedModule);\n const mod = createSyntheticModule(importedModule, exportNames, target);\n imports.set(target, mod);\n return mod;\n};\n\nconst loadDynamicModule = async (target: string) => {\n const mod = await loadModule(target);\n if (mod.status !== 'evaluated') {\n await mod.evaluate();\n }\n return mod;\n};\nconst mod = new SourceTextModule(source, {\n identifier: resolvedBenchmarkUrl,\n context,\n initializeImportMeta(meta) {\n meta.url = resolvedBenchmarkUrl;\n },\n importModuleDynamically(specifier) {\n const resolved = resolveSpecifier(specifier);\n return loadDynamicModule(resolved);\n },\n});\n\nawait mod.link(async (specifier) => loadModule(resolveSpecifier(specifier)));\n\nawait mod.evaluate();\nconst { setup, teardown, pre, run, post } = mod.namespace as any;\n\nif (!run) {\n throw new Error('Benchmark run function is required');\n}\n\nprocess.exitCode = await benchmark({\n setup,\n teardown,\n pre,\n run,\n post,\n data,\n\n warmupCycles,\n minCycles,\n absThreshold,\n relThreshold,\n gcObserver,\n\n durationsSAB,\n controlSAB,\n});\n"],"names":["benchmarkUrl","setupCode","teardownCode","preCode","runCode","postCode","data","warmupCycles","minCycles","absThreshold","relThreshold","gcObserver","durationsSAB","controlSAB","workerData","serialize","code","resolvedBenchmarkUrl","pathToFileURL","process","cwd","href","benchmarkDirUrl","URL","requireFrom","createRequire","fileURLToPath","resolveSpecifier","specifier","startsWith","isAbsolute","resolve","source","globals","Object","create","k","getOwnPropertyNames","globalThis","context","createContext","imports","Map","createSyntheticModule","moduleExports","exportNames","identifier","mod","SyntheticModule","name","setExport","isCjsModule","target","endsWith","toRequireTarget","loadModule","cached","get","required","keys","includes","push","set","importedModule","loadDynamicModule","status","evaluate","SourceTextModule","initializeImportMeta","meta","url","importModuleDynamically","resolved","link","setup","teardown","pre","run","post","namespace","Error","exitCode","benchmark"],"mappings":";;;;oCAA2B;wBACsC;4BACnC;0BACH;yBACkB;2BACnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG1B,MAAM,EACJA,YAAY,EACZC,SAAS,EACTC,YAAY,EACZC,OAAO,EACPC,OAAO,EACPC,QAAQ,EACRC,IAAI,EAEJC,YAAY,EACZC,SAAS,EACTC,YAAY,EACZC,YAAY,EACZC,aAAa,IAAI,EAEjBC,YAAY,EACZC,UAAU,EACX,GAAkBC,8BAAU;AAE7B,MAAMC,YAAY,CAACC,OAAmBA,OAAOA,OAAO;AAEpD,MAAMC,uBAAuB,OAAOjB,iBAAiB,WAAWA,eAAekB,IAAAA,sBAAa,EAACC,QAAQC,GAAG,IAAIC,IAAI;AAChH,MAAMC,kBAAkB,IAAIC,IAAI,KAAKN,sBAAsBI,IAAI;AAC/D,MAAMG,cAAcC,IAAAA,yBAAa,EAACC,IAAAA,sBAAa,EAAC,IAAIH,IAAI,gBAAgBD;AAExE,MAAMK,mBAAmB,CAACC;IACxB,IAAIA,UAAUC,UAAU,CAAC,UAAU;QACjC,OAAOD;IACT;IACA,IAAIA,UAAUC,UAAU,CA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C;IACjCR;IACAC;IACAC;IACAC;IACAC;IACAxE;IAEAC;IACAC;IACAC;IACAC;IACAC;IAEAC;IACAC;AACF"}
|
package/build/worker.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { workerData } from 'node:worker_threads';
|
|
2
|
-
import { SourceTextModule, SyntheticModule, createContext } from 'node:vm';
|
|
3
|
-
import { createRequire } from 'node:module';
|
|
4
|
-
import { isAbsolute } from 'node:path';
|
|
5
|
-
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
6
|
-
import { benchmark } from "./runner.js";
|
|
7
|
-
const { benchmarkUrl, setupCode, teardownCode, preCode, runCode, postCode, data, warmupCycles, minCycles, absThreshold, relThreshold, gcObserver = true, durationsSAB, controlSAB } = workerData;
|
|
8
|
-
const serialize = (code)=>code ? code : 'undefined';
|
|
9
|
-
const resolvedBenchmarkUrl = typeof benchmarkUrl === 'string' ? benchmarkUrl : pathToFileURL(process.cwd()).href;
|
|
10
|
-
const benchmarkDirUrl = new URL('.', resolvedBenchmarkUrl).href;
|
|
11
|
-
const requireFrom = createRequire(fileURLToPath(new URL('benchmark.js', benchmarkDirUrl)));
|
|
12
|
-
const resolveSpecifier = (specifier)=>{
|
|
13
|
-
if (specifier.startsWith('file:')) {
|
|
14
|
-
return specifier;
|
|
15
|
-
}
|
|
16
|
-
if (specifier.startsWith('./') || specifier.startsWith('../')) {
|
|
17
|
-
return new URL(specifier, benchmarkDirUrl).href;
|
|
18
|
-
}
|
|
19
|
-
if (isAbsolute(specifier)) {
|
|
20
|
-
return pathToFileURL(specifier).href;
|
|
21
|
-
}
|
|
22
|
-
return requireFrom.resolve(specifier);
|
|
23
|
-
};
|
|
24
|
-
const source = `
|
|
25
|
-
export const setup = ${serialize(setupCode)};
|
|
26
|
-
export const teardown = ${serialize(teardownCode)};
|
|
27
|
-
export const pre = ${serialize(preCode)};
|
|
28
|
-
export const run = ${serialize(runCode)};
|
|
29
|
-
export const post = ${serialize(postCode)};
|
|
30
|
-
`;
|
|
31
|
-
const globals = Object.create(null);
|
|
32
|
-
for (const k of Object.getOwnPropertyNames(globalThis)){
|
|
33
|
-
globals[k] = globalThis[k];
|
|
34
|
-
}
|
|
35
|
-
const context = createContext(globals);
|
|
36
|
-
const imports = new Map();
|
|
37
|
-
const createSyntheticModule = (moduleExports, exportNames, identifier)=>{
|
|
38
|
-
const mod = new SyntheticModule(exportNames, ()=>{
|
|
39
|
-
for (const name of exportNames){
|
|
40
|
-
if (name === 'default') {
|
|
41
|
-
mod.setExport(name, moduleExports);
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
mod.setExport(name, moduleExports[name]);
|
|
45
|
-
}
|
|
46
|
-
}, {
|
|
47
|
-
identifier,
|
|
48
|
-
context
|
|
49
|
-
});
|
|
50
|
-
return mod;
|
|
51
|
-
};
|
|
52
|
-
const isCjsModule = (target)=>target.endsWith('.cjs') || target.endsWith('.cts');
|
|
53
|
-
const toRequireTarget = (target)=>target.startsWith('file:') ? fileURLToPath(target) : target;
|
|
54
|
-
const loadModule = async (target)=>{
|
|
55
|
-
const cached = imports.get(target);
|
|
56
|
-
if (cached) return cached;
|
|
57
|
-
if (isCjsModule(target)) {
|
|
58
|
-
const required = requireFrom(toRequireTarget(target));
|
|
59
|
-
const exportNames = required && (typeof required === 'object' || typeof required === 'function') ? Object.keys(required) : [];
|
|
60
|
-
if (!exportNames.includes('default')) {
|
|
61
|
-
exportNames.push('default');
|
|
62
|
-
}
|
|
63
|
-
const mod = createSyntheticModule(required, exportNames, target);
|
|
64
|
-
imports.set(target, mod);
|
|
65
|
-
return mod;
|
|
66
|
-
}
|
|
67
|
-
const importedModule = await import(target);
|
|
68
|
-
const exportNames = Object.keys(importedModule);
|
|
69
|
-
const mod = createSyntheticModule(importedModule, exportNames, target);
|
|
70
|
-
imports.set(target, mod);
|
|
71
|
-
return mod;
|
|
72
|
-
};
|
|
73
|
-
const loadDynamicModule = async (target)=>{
|
|
74
|
-
const mod = await loadModule(target);
|
|
75
|
-
if (mod.status !== 'evaluated') {
|
|
76
|
-
await mod.evaluate();
|
|
77
|
-
}
|
|
78
|
-
return mod;
|
|
79
|
-
};
|
|
80
|
-
const mod = new SourceTextModule(source, {
|
|
81
|
-
identifier: resolvedBenchmarkUrl,
|
|
82
|
-
context,
|
|
83
|
-
initializeImportMeta (meta) {
|
|
84
|
-
meta.url = resolvedBenchmarkUrl;
|
|
85
|
-
},
|
|
86
|
-
importModuleDynamically (specifier) {
|
|
87
|
-
const resolved = resolveSpecifier(specifier);
|
|
88
|
-
return loadDynamicModule(resolved);
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
await mod.link(async (specifier)=>loadModule(resolveSpecifier(specifier)));
|
|
92
|
-
await mod.evaluate();
|
|
93
|
-
const { setup, teardown, pre, run, post } = mod.namespace;
|
|
94
|
-
if (!run) {
|
|
95
|
-
throw new Error('Benchmark run function is required');
|
|
96
|
-
}
|
|
97
|
-
process.exitCode = await benchmark({
|
|
98
|
-
setup,
|
|
99
|
-
teardown,
|
|
100
|
-
pre,
|
|
101
|
-
run,
|
|
102
|
-
post,
|
|
103
|
-
data,
|
|
104
|
-
warmupCycles,
|
|
105
|
-
minCycles,
|
|
106
|
-
absThreshold,
|
|
107
|
-
relThreshold,
|
|
108
|
-
gcObserver,
|
|
109
|
-
durationsSAB,
|
|
110
|
-
controlSAB
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
//# sourceMappingURL=worker.js.map
|
package/build/worker.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/worker.ts"],"sourcesContent":["import { workerData } from 'node:worker_threads';\nimport { SourceTextModule, SyntheticModule, createContext } from 'node:vm';\nimport { createRequire } from 'node:module';\nimport { isAbsolute } from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport { benchmark } from './runner.js';\nimport { WorkerOptions } from './types.js';\n\nconst {\n benchmarkUrl,\n setupCode,\n teardownCode,\n preCode,\n runCode,\n postCode,\n data,\n\n warmupCycles,\n minCycles,\n absThreshold,\n relThreshold,\n gcObserver = true,\n\n durationsSAB,\n controlSAB,\n}: WorkerOptions = workerData;\n\nconst serialize = (code?: string) => (code ? code : 'undefined');\n\nconst resolvedBenchmarkUrl = typeof benchmarkUrl === 'string' ? benchmarkUrl : pathToFileURL(process.cwd()).href;\nconst benchmarkDirUrl = new URL('.', resolvedBenchmarkUrl).href;\nconst requireFrom = createRequire(fileURLToPath(new URL('benchmark.js', benchmarkDirUrl)));\n\nconst resolveSpecifier = (specifier: string) => {\n if (specifier.startsWith('file:')) {\n return specifier;\n }\n if (specifier.startsWith('./') || specifier.startsWith('../')) {\n return new URL(specifier, benchmarkDirUrl).href;\n }\n if (isAbsolute(specifier)) {\n return pathToFileURL(specifier).href;\n }\n return requireFrom.resolve(specifier);\n};\n\nconst source = `\nexport const setup = ${serialize(setupCode)};\nexport const teardown = ${serialize(teardownCode)};\nexport const pre = ${serialize(preCode)};\nexport const run = ${serialize(runCode)};\nexport const post = ${serialize(postCode)};\n `;\n\nconst globals = Object.create(null);\nfor (const k of Object.getOwnPropertyNames(globalThis)) {\n globals[k] = (globalThis as any)[k];\n}\nconst context = createContext(globals);\nconst imports = new Map<string, SyntheticModule>();\n\nconst createSyntheticModule = (moduleExports: unknown, exportNames: string[], identifier: string) => {\n const mod = new SyntheticModule(\n exportNames,\n () => {\n for (const name of exportNames) {\n if (name === 'default') {\n mod.setExport(name, moduleExports);\n continue;\n }\n mod.setExport(name, (moduleExports as Record<string, unknown>)[name]);\n }\n },\n { identifier, context },\n );\n return mod;\n};\n\nconst isCjsModule = (target: string) => target.endsWith('.cjs') || target.endsWith('.cts');\n\nconst toRequireTarget = (target: string) => (target.startsWith('file:') ? fileURLToPath(target) : target);\n\nconst loadModule = async (target: string) => {\n const cached = imports.get(target);\n if (cached) return cached;\n\n if (isCjsModule(target)) {\n const required = requireFrom(toRequireTarget(target));\n const exportNames = required && (typeof required === 'object' || typeof required === 'function') ? Object.keys(required) : [];\n if (!exportNames.includes('default')) {\n exportNames.push('default');\n }\n const mod = createSyntheticModule(required, exportNames, target);\n imports.set(target, mod);\n return mod;\n }\n\n const importedModule = await import(target);\n const exportNames = Object.keys(importedModule);\n const mod = createSyntheticModule(importedModule, exportNames, target);\n imports.set(target, mod);\n return mod;\n};\n\nconst loadDynamicModule = async (target: string) => {\n const mod = await loadModule(target);\n if (mod.status !== 'evaluated') {\n await mod.evaluate();\n }\n return mod;\n};\nconst mod = new SourceTextModule(source, {\n identifier: resolvedBenchmarkUrl,\n context,\n initializeImportMeta(meta) {\n meta.url = resolvedBenchmarkUrl;\n },\n importModuleDynamically(specifier) {\n const resolved = resolveSpecifier(specifier);\n return loadDynamicModule(resolved);\n },\n});\n\nawait mod.link(async (specifier) => loadModule(resolveSpecifier(specifier)));\n\nawait mod.evaluate();\nconst { setup, teardown, pre, run, post } = mod.namespace as any;\n\nif (!run) {\n throw new Error('Benchmark run function is required');\n}\n\nprocess.exitCode = await benchmark({\n setup,\n teardown,\n pre,\n run,\n post,\n data,\n\n warmupCycles,\n minCycles,\n absThreshold,\n relThreshold,\n gcObserver,\n\n durationsSAB,\n controlSAB,\n});\n"],"names":["workerData","SourceTextModule","SyntheticModule","createContext","createRequire","isAbsolute","fileURLToPath","pathToFileURL","benchmark","benchmarkUrl","setupCode","teardownCode","preCode","runCode","postCode","data","warmupCycles","minCycles","absThreshold","relThreshold","gcObserver","durationsSAB","controlSAB","serialize","code","resolvedBenchmarkUrl","process","cwd","href","benchmarkDirUrl","URL","requireFrom","resolveSpecifier","specifier","startsWith","resolve","source","globals","Object","create","k","getOwnPropertyNames","globalThis","context","imports","Map","createSyntheticModule","moduleExports","exportNames","identifier","mod","name","setExport","isCjsModule","target","endsWith","toRequireTarget","loadModule","cached","get","required","keys","includes","push","set","importedModule","loadDynamicModule","status","evaluate","initializeImportMeta","meta","url","importModuleDynamically","resolved","link","setup","teardown","pre","run","post","namespace","Error","exitCode"],"mappings":"AAAA,SAASA,UAA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