benchforge 0.1.1 → 0.1.3
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 +15 -129
- package/dist/BenchRunner-BLfGX2wQ.d.mts +225 -0
- package/dist/{TimingUtils-D4z1jpp2.mjs → TimingUtils-ClclVQ7E.mjs} +276 -278
- package/dist/TimingUtils-ClclVQ7E.mjs.map +1 -0
- package/dist/bin/benchforge.d.mts +1 -0
- package/dist/bin/benchforge.mjs +1 -1
- package/dist/index.d.mts +711 -0
- package/dist/index.mjs +2 -2
- package/dist/runners/WorkerScript.d.mts +39 -0
- package/dist/runners/WorkerScript.mjs +1 -1
- package/dist/{src-cYpHvc40.mjs → src-JGOI6_Sc.mjs} +22 -23
- package/dist/src-JGOI6_Sc.mjs.map +1 -0
- package/package.json +1 -1
- package/src/StandardSections.ts +1 -8
- package/src/browser/BrowserHeapSampler.ts +3 -2
- package/src/cli/CliArgs.ts +11 -14
- package/src/cli/RunBenchCLI.ts +1 -4
- package/src/runners/BasicRunner.ts +0 -4
- package/src/table-util/Formatters.ts +1 -1
- package/dist/TimingUtils-D4z1jpp2.mjs.map +0 -1
- package/dist/src-cYpHvc40.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as timeSection, B as parseCliArgs, C as adaptiveSection, D as gcStatsSection, E as gcSection, F as generateHtmlReport, G as truncate, H as formatBytes, I as formatDateWithTimezone, J as loadCaseData, K as isStatefulVariant, L as prepareHtmlData, M as formatConvergence, N as filterMatrix, O as optSection, P as parseMatrixFilter, R as exportPerfettoTrace, S as reportMatrixResults, T as cpuSection, U as integer, V as reportResults, W as timeMs, Y as loadCasesModule, _ as runDefaultMatrixBench, a as cliToMatrixOptions, b as gcStatsColumns, c as exportReports, d as matrixToReportGroups, f as parseBenchArgs, g as runDefaultBench, h as runBenchmarks, i as benchExports, j as totalTimeSection, k as runsSection, l as hasField, m as reportOptStatus, n as getBaselineVersion, o as defaultMatrixReport, p as printHeapReports, q as runMatrix, r as getCurrentGitVersion, s as defaultReport, t as formatGitVersion, u as matrixBenchExports, v as runMatrixSuite, w as buildGenericSections, x as heapTotalColumn, y as gcPauseColumn, z as defaultCliArgs } from "./src-
|
|
2
|
-
import {
|
|
1
|
+
import { A as timeSection, B as parseCliArgs, C as adaptiveSection, D as gcStatsSection, E as gcSection, F as generateHtmlReport, G as truncate, H as formatBytes, I as formatDateWithTimezone, J as loadCaseData, K as isStatefulVariant, L as prepareHtmlData, M as formatConvergence, N as filterMatrix, O as optSection, P as parseMatrixFilter, R as exportPerfettoTrace, S as reportMatrixResults, T as cpuSection, U as integer, V as reportResults, W as timeMs, Y as loadCasesModule, _ as runDefaultMatrixBench, a as cliToMatrixOptions, b as gcStatsColumns, c as exportReports, d as matrixToReportGroups, f as parseBenchArgs, g as runDefaultBench, h as runBenchmarks, i as benchExports, j as totalTimeSection, k as runsSection, l as hasField, m as reportOptStatus, n as getBaselineVersion, o as defaultMatrixReport, p as printHeapReports, q as runMatrix, r as getCurrentGitVersion, s as defaultReport, t as formatGitVersion, u as matrixBenchExports, v as runMatrixSuite, w as buildGenericSections, x as heapTotalColumn, y as gcPauseColumn, z as defaultCliArgs } from "./src-JGOI6_Sc.mjs";
|
|
2
|
+
import { o as average } from "./TimingUtils-ClclVQ7E.mjs";
|
|
3
3
|
|
|
4
4
|
export { adaptiveSection, average, benchExports, buildGenericSections, cliToMatrixOptions, cpuSection, defaultCliArgs, defaultMatrixReport, defaultReport, exportPerfettoTrace, exportReports, filterMatrix, formatBytes, formatConvergence, formatDateWithTimezone, formatGitVersion, gcPauseColumn, gcSection, gcStatsColumns, gcStatsSection, generateHtmlReport, getBaselineVersion, getCurrentGitVersion, hasField, heapTotalColumn, integer, isStatefulVariant, loadCaseData, loadCasesModule, matrixBenchExports, matrixToReportGroups, optSection, parseBenchArgs, parseCliArgs, parseMatrixFilter, prepareHtmlData, printHeapReports, reportMatrixResults, reportOptStatus, reportResults, runBenchmarks, runDefaultBench, runDefaultMatrixBench, runMatrix, runMatrixSuite, runsSection, timeMs, timeSection, totalTimeSection, truncate };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { a as MeasuredResults, i as BenchmarkSpec, o as HeapProfile, t as RunnerOptions } from "../BenchRunner-BLfGX2wQ.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/runners/CreateRunner.d.ts
|
|
4
|
+
type KnownRunner = "basic";
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/runners/WorkerScript.d.ts
|
|
7
|
+
/** Message sent to worker process to start a benchmark run. */
|
|
8
|
+
interface RunMessage {
|
|
9
|
+
type: "run";
|
|
10
|
+
spec: BenchmarkSpec;
|
|
11
|
+
runnerName: KnownRunner;
|
|
12
|
+
options: RunnerOptions;
|
|
13
|
+
fnCode?: string;
|
|
14
|
+
modulePath?: string;
|
|
15
|
+
exportName?: string;
|
|
16
|
+
setupExportName?: string;
|
|
17
|
+
params?: unknown;
|
|
18
|
+
variantDir?: string;
|
|
19
|
+
variantId?: string;
|
|
20
|
+
caseData?: unknown;
|
|
21
|
+
caseId?: string;
|
|
22
|
+
casesModule?: string;
|
|
23
|
+
}
|
|
24
|
+
/** Message returned from worker process with benchmark results. */
|
|
25
|
+
interface ResultMessage {
|
|
26
|
+
type: "result";
|
|
27
|
+
results: MeasuredResults[];
|
|
28
|
+
heapProfile?: HeapProfile;
|
|
29
|
+
}
|
|
30
|
+
/** Message returned from worker process when benchmark fails. */
|
|
31
|
+
interface ErrorMessage {
|
|
32
|
+
type: "error";
|
|
33
|
+
error: string;
|
|
34
|
+
stack?: string;
|
|
35
|
+
}
|
|
36
|
+
type WorkerMessage = RunMessage | ResultMessage | ErrorMessage;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { ErrorMessage, ResultMessage, RunMessage, WorkerMessage };
|
|
39
|
+
//# sourceMappingURL=WorkerScript.d.mts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { a as createAdaptiveWrapper, d as variantModuleUrl, i as createRunner, n as getElapsed, r as getPerfNow, t as debugWorkerTiming } from "../TimingUtils-ClclVQ7E.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/runners/WorkerScript.ts
|
|
5
5
|
const workerStartTime = getPerfNow();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as createAdaptiveWrapper, c as BasicRunner, i as createRunner, l as computeStats, n as getElapsed, o as average, r as getPerfNow, s as bootstrapDifferenceCI, t as debugWorkerTiming, u as discoverVariants } from "./TimingUtils-ClclVQ7E.mjs";
|
|
2
2
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import { execSync, fork, spawn } from "node:child_process";
|
|
@@ -843,14 +843,11 @@ function injectDiffColumns(reportGroups) {
|
|
|
843
843
|
|
|
844
844
|
//#endregion
|
|
845
845
|
//#region src/cli/CliArgs.ts
|
|
846
|
-
const defaultTime = .642;
|
|
847
846
|
const defaultAdaptiveMaxTime = 20;
|
|
848
|
-
const defaultPauseInterval = 0;
|
|
849
|
-
const defaultPauseDuration = 100;
|
|
850
847
|
const cliOptions = {
|
|
851
848
|
time: {
|
|
852
849
|
type: "number",
|
|
853
|
-
default:
|
|
850
|
+
default: .642,
|
|
854
851
|
requiresArg: true,
|
|
855
852
|
describe: "test duration in seconds"
|
|
856
853
|
},
|
|
@@ -892,17 +889,17 @@ const cliOptions = {
|
|
|
892
889
|
adaptive: {
|
|
893
890
|
type: "boolean",
|
|
894
891
|
default: false,
|
|
895
|
-
describe: "
|
|
892
|
+
describe: "adaptive sampling (experimental)"
|
|
896
893
|
},
|
|
897
894
|
"min-time": {
|
|
898
895
|
type: "number",
|
|
899
896
|
default: 1,
|
|
900
|
-
describe: "minimum time
|
|
897
|
+
describe: "minimum time before adaptive convergence can stop"
|
|
901
898
|
},
|
|
902
899
|
convergence: {
|
|
903
900
|
type: "number",
|
|
904
901
|
default: 95,
|
|
905
|
-
describe: "confidence threshold (0-100)"
|
|
902
|
+
describe: "adaptive confidence threshold (0-100)"
|
|
906
903
|
},
|
|
907
904
|
warmup: {
|
|
908
905
|
type: "number",
|
|
@@ -945,12 +942,12 @@ const cliOptions = {
|
|
|
945
942
|
},
|
|
946
943
|
"pause-interval": {
|
|
947
944
|
type: "number",
|
|
948
|
-
default:
|
|
945
|
+
default: 0,
|
|
949
946
|
describe: "iterations between pauses for V8 optimization (0 to disable)"
|
|
950
947
|
},
|
|
951
948
|
"pause-duration": {
|
|
952
949
|
type: "number",
|
|
953
|
-
default:
|
|
950
|
+
default: 100,
|
|
954
951
|
describe: "pause duration in ms for V8 optimization"
|
|
955
952
|
},
|
|
956
953
|
batches: {
|
|
@@ -1012,6 +1009,11 @@ const cliOptions = {
|
|
|
1012
1009
|
type: "number",
|
|
1013
1010
|
default: 60,
|
|
1014
1011
|
describe: "browser page timeout in seconds"
|
|
1012
|
+
},
|
|
1013
|
+
"chrome-args": {
|
|
1014
|
+
type: "string",
|
|
1015
|
+
requiresArg: true,
|
|
1016
|
+
describe: "extra Chromium flags (space-separated)"
|
|
1015
1017
|
}
|
|
1016
1018
|
};
|
|
1017
1019
|
/** @return yargs with standard benchmark options */
|
|
@@ -1056,10 +1058,13 @@ function browserGcStats(traceEvents) {
|
|
|
1056
1058
|
* Bench function (window.__bench): CLI controls iteration and timing.
|
|
1057
1059
|
* Lap mode (__start/__lap/__done): page controls the measured region. */
|
|
1058
1060
|
async function profileBrowser(params) {
|
|
1059
|
-
const { url, headless = true, timeout = 60 } = params;
|
|
1061
|
+
const { url, headless = true, chromeArgs, timeout = 60 } = params;
|
|
1060
1062
|
const { gcStats: collectGc } = params;
|
|
1061
1063
|
const { samplingInterval = 32768 } = params.heapOptions ?? {};
|
|
1062
|
-
const browser = await chromium.launch({
|
|
1064
|
+
const browser = await chromium.launch({
|
|
1065
|
+
headless,
|
|
1066
|
+
args: chromeArgs
|
|
1067
|
+
});
|
|
1063
1068
|
try {
|
|
1064
1069
|
const page = await browser.newPage();
|
|
1065
1070
|
page.setDefaultTimeout(timeout * 1e3);
|
|
@@ -2072,13 +2077,12 @@ function formatConvergence(v) {
|
|
|
2072
2077
|
|
|
2073
2078
|
//#endregion
|
|
2074
2079
|
//#region src/StandardSections.ts
|
|
2075
|
-
/** Section: mean, p50, p99 timing
|
|
2080
|
+
/** Section: mean, p50, p99 timing */
|
|
2076
2081
|
const timeSection = {
|
|
2077
2082
|
extract: (results) => ({
|
|
2078
2083
|
mean: results.time?.avg,
|
|
2079
2084
|
p50: results.time?.p50,
|
|
2080
|
-
p99: results.time?.p99
|
|
2081
|
-
convergence: results.convergence?.confidence
|
|
2085
|
+
p99: results.time?.p99
|
|
2082
2086
|
}),
|
|
2083
2087
|
columns: () => [{
|
|
2084
2088
|
groupTitle: "time",
|
|
@@ -2102,11 +2106,7 @@ const timeSection = {
|
|
|
2102
2106
|
comparable: true
|
|
2103
2107
|
}
|
|
2104
2108
|
]
|
|
2105
|
-
}
|
|
2106
|
-
key: "convergence",
|
|
2107
|
-
title: "conv%",
|
|
2108
|
-
formatter: formatConvergence
|
|
2109
|
-
}] }]
|
|
2109
|
+
}]
|
|
2110
2110
|
};
|
|
2111
2111
|
/** Section: GC time as fraction of total benchmark time (Node performance hooks) */
|
|
2112
2112
|
const gcSection = {
|
|
@@ -2654,7 +2654,6 @@ function mergeResults(results) {
|
|
|
2654
2654
|
const allSamples = results.flatMap((r) => r.samples);
|
|
2655
2655
|
const allWarmup = results.flatMap((r) => r.warmupSamples || []);
|
|
2656
2656
|
const time = computeStats(allSamples);
|
|
2657
|
-
const convergence = checkConvergence(allSamples.map((s) => s * msToNs));
|
|
2658
2657
|
let offset = 0;
|
|
2659
2658
|
const allPausePoints = results.flatMap((r) => {
|
|
2660
2659
|
const pts = (r.pausePoints ?? []).map((p) => ({
|
|
@@ -2670,7 +2669,6 @@ function mergeResults(results) {
|
|
|
2670
2669
|
warmupSamples: allWarmup.length ? allWarmup : void 0,
|
|
2671
2670
|
time,
|
|
2672
2671
|
totalTime: results.reduce((sum, r) => sum + (r.totalTime || 0), 0),
|
|
2673
|
-
convergence,
|
|
2674
2672
|
pausePoints: allPausePoints.length ? allPausePoints : void 0
|
|
2675
2673
|
};
|
|
2676
2674
|
}
|
|
@@ -2717,6 +2715,7 @@ async function browserBenchExports(args) {
|
|
|
2717
2715
|
stackDepth: args["heap-depth"]
|
|
2718
2716
|
},
|
|
2719
2717
|
headless: args.headless,
|
|
2718
|
+
chromeArgs: args["chrome-args"]?.split(/\s+/).filter(Boolean),
|
|
2720
2719
|
timeout: args.timeout,
|
|
2721
2720
|
gcStats: args["gc-stats"],
|
|
2722
2721
|
maxTime: iterations ? Number.MAX_SAFE_INTEGER : time * 1e3,
|
|
@@ -3086,4 +3085,4 @@ function getMostRecentModifiedDate(dir) {
|
|
|
3086
3085
|
|
|
3087
3086
|
//#endregion
|
|
3088
3087
|
export { timeSection as A, parseCliArgs as B, adaptiveSection as C, gcStatsSection as D, gcSection as E, generateHtmlReport as F, truncate as G, formatBytes as H, formatDateWithTimezone as I, loadCaseData as J, isStatefulVariant as K, prepareHtmlData as L, formatConvergence as M, filterMatrix as N, optSection as O, parseMatrixFilter as P, exportPerfettoTrace as R, reportMatrixResults as S, cpuSection as T, integer as U, reportResults as V, timeMs as W, loadCasesModule as Y, runDefaultMatrixBench as _, cliToMatrixOptions as a, gcStatsColumns as b, exportReports as c, matrixToReportGroups as d, parseBenchArgs as f, runDefaultBench as g, runBenchmarks as h, benchExports as i, totalTimeSection as j, runsSection as k, hasField as l, reportOptStatus as m, getBaselineVersion as n, defaultMatrixReport as o, printHeapReports as p, runMatrix as q, getCurrentGitVersion as r, defaultReport as s, formatGitVersion as t, matrixBenchExports as u, runMatrixSuite as v, buildGenericSections as w, heapTotalColumn as x, gcPauseColumn as y, defaultCliArgs as z };
|
|
3089
|
-
//# sourceMappingURL=src-
|
|
3088
|
+
//# sourceMappingURL=src-JGOI6_Sc.mjs.map
|