ostia 0.2.12 → 0.3.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/LICENSE +21 -0
- package/README.md +50 -358
- package/docs/agent-protocol.md +210 -0
- package/docs/cli.md +1196 -0
- package/docs/config.md +233 -0
- package/docs/document-schema.md +224 -0
- package/docs/library.md +421 -0
- package/docs/preload-recipes.md +169 -0
- package/docs/statistics.md +218 -0
- package/index.d.ts +894 -677
- package/package.json +16 -14
- package/src/ab/ab-runner.ts +474 -0
- package/src/ab/index.ts +1086 -0
- package/src/baseline/index.ts +75 -0
- package/src/bench/index.ts +462 -0
- package/src/bench/projects.ts +39 -0
- package/src/bench/range.ts +27 -0
- package/src/bench/registry.ts +424 -0
- package/src/bench/run-tasks.ts +176 -0
- package/src/bench/run.ts +51 -0
- package/src/bench/runner.ts +147 -0
- package/src/bench/support.ts +161 -0
- package/src/bench/sweep.ts +39 -0
- package/src/cache/fingerprint.ts +59 -0
- package/src/cache/store.ts +28 -0
- package/src/capture/bunflags.ts +91 -0
- package/src/capture/cpu-parse.ts +119 -0
- package/src/capture/cpu.ts +44 -0
- package/src/capture/frames.ts +54 -0
- package/src/capture/heap-parse.ts +86 -0
- package/src/capture/heap.ts +32 -0
- package/src/capture/inspector.ts +46 -0
- package/src/capture/jsc-parse.ts +167 -0
- package/src/capture/jsc.ts +35 -0
- package/src/capture/sampling.ts +5 -0
- package/src/ci/index.ts +416 -0
- package/src/cli/flags.ts +264 -0
- package/{chunk-9sx15b08.js → src/cli/help.ts} +23 -11
- package/src/cli/main.ts +18 -0
- package/src/cli/output.ts +185 -0
- package/src/cli/run.ts +1110 -0
- package/src/compare/index.ts +617 -0
- package/src/config/index.ts +275 -0
- package/src/config/validate.ts +267 -0
- package/src/errors.ts +8 -0
- package/src/format.ts +36 -0
- package/src/glob.ts +48 -0
- package/src/index.ts +62 -0
- package/src/ir/cpu.ts +10 -0
- package/src/ir/document.ts +471 -0
- package/src/ir/fp.ts +31 -0
- package/src/ir/git.ts +36 -0
- package/src/ir/types.ts +615 -0
- package/src/measure/alloc.ts +57 -0
- package/src/measure/cpu.ts +99 -0
- package/src/measure/environment.ts +41 -0
- package/src/measure/inprocess.ts +191 -0
- package/src/measure/instructions.ts +133 -0
- package/src/measure/loop.ts +57 -0
- package/src/measure/noise.ts +55 -0
- package/src/measure/paired.ts +312 -0
- package/src/measure/peak.ts +202 -0
- package/src/measure/timing.ts +263 -0
- package/src/profile.ts +109 -0
- package/src/renderers/collapsed.ts +35 -0
- package/src/renderers/cpu-tree.ts +183 -0
- package/src/renderers/cpuprofile.ts +43 -0
- package/src/renderers/format.ts +142 -0
- package/src/renderers/index.ts +27 -0
- package/src/renderers/json.ts +10 -0
- package/src/renderers/jsonl.ts +15 -0
- package/src/renderers/markdown.ts +525 -0
- package/src/renderers/mermaid.ts +78 -0
- package/src/renderers/minimal.ts +602 -0
- package/src/renderers/paired.ts +229 -0
- package/src/renderers/relative.ts +64 -0
- package/src/renderers/select.ts +286 -0
- package/src/renderers/speedscope.ts +69 -0
- package/src/renderers/terminal.ts +466 -0
- package/src/renderers/types.ts +27 -0
- package/src/spawn/index.ts +396 -0
- package/src/stats/bootstrap.ts +153 -0
- package/src/stats/index.ts +140 -0
- package/src/stats/mannwhitney.ts +81 -0
- package/src/time.ts +325 -0
- package/src/version.ts +3 -0
- package/ab-runner.ts +0 -8
- package/chunk-05jfst35.js +0 -28
- package/chunk-1g1x9zz2.js +0 -15
- package/chunk-23g2rwrn.js +0 -3
- package/chunk-468h5412.js +0 -25
- package/chunk-4esjfc2m.js +0 -2
- package/chunk-ct2xsezd.js +0 -14
- package/cli.js +0 -3
- package/index.js +0 -2
- package/runner.ts +0 -7
package/index.d.ts
CHANGED
|
@@ -1,153 +1,138 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* many
|
|
21
|
-
*
|
|
1
|
+
export interface AbOptions {
|
|
2
|
+
suites: string[];
|
|
3
|
+
/** Git ref whose committed tree is the base side (default: `"HEAD"`); the
|
|
4
|
+
* candidate is the working tree, uncommitted changes included. */
|
|
5
|
+
base?: string;
|
|
6
|
+
/** Rounds per workload, each one base batch and one candidate batch of
|
|
7
|
+
* about 10ms (default: 15). */
|
|
8
|
+
rounds?: number;
|
|
9
|
+
/** What to judge each round by: the candidate/base time ratio
|
|
10
|
+
* (`"time"`, the default), or the ratio of instructions each side retired
|
|
11
|
+
* per call (`"instructions"`), which a loaded machine barely moves, so a
|
|
12
|
+
* lower `thresholdPct` holds. Instructions are recorded either way where
|
|
13
|
+
* the machine counts them (see `PairedEvidence.instructions`); asking to
|
|
14
|
+
* judge by them where it can't throws an `OstiaUsageError`. */
|
|
15
|
+
metric?: "time" | "instructions";
|
|
16
|
+
/** Flag a workload whose median candidate/base ratio moves past this many
|
|
17
|
+
* percent (default: 10). */
|
|
18
|
+
thresholdPct?: number;
|
|
19
|
+
/** Fail when the geometric mean of all workloads' ratios is slower than
|
|
20
|
+
* this many percent (default: 1.5): a broad slowdown too small to flag any
|
|
21
|
+
* one workload. */
|
|
22
|
+
geomeanThresholdPct?: number;
|
|
23
|
+
/** Fresh-process repeats of each flagged workload, which only counts when
|
|
24
|
+
* every repeat flags it the same way (default: 2; 0 trusts the first). */
|
|
25
|
+
confirm?: number;
|
|
26
|
+
filter?: string;
|
|
27
|
+
preload?: string[];
|
|
28
|
+
bunFlags?: string[];
|
|
29
|
+
/** Per-suite `preload` / `bunFlags`; see `BenchOptions.projects`. */
|
|
30
|
+
projects?: BenchProject[];
|
|
31
|
+
outDir?: string;
|
|
32
|
+
cwd?: string;
|
|
33
|
+
noiseCheck?: boolean;
|
|
34
|
+
/** Also compare each side's retained heap per call (see
|
|
35
|
+
* `bench({ alloc })`) and how far its first call raises RSS (see
|
|
36
|
+
* `bench({ peakMem })`), each the median of 3 fresh processes per side.
|
|
37
|
+
* Task/group options override these. */
|
|
38
|
+
alloc?: boolean;
|
|
39
|
+
peakMem?: boolean;
|
|
40
|
+
/** Flag a memory reading that moves past this many percent of the base's
|
|
41
|
+
* and past its noise floor (default: 10). A memory regression fails the
|
|
42
|
+
* run. */
|
|
43
|
+
memThresholdPct?: number;
|
|
44
|
+
/** Shell commands run once, in order, in a freshly extracted base tree
|
|
45
|
+
* before it's used: to build what the suites import but git doesn't hold
|
|
46
|
+
* (generated or gitignored files). Each runs with its cwd at the tree's
|
|
47
|
+
* counterpart of `cwd`, the project's `node_modules` linked in, and
|
|
48
|
+
* `OSTIA_AB_SHA` / `OSTIA_AB_CANDIDATE_DIR` (the working tree's `cwd`) in
|
|
49
|
+
* its environment. The tree is cached per commit and command list. */
|
|
50
|
+
baseSetup?: string | string[];
|
|
51
|
+
/** Base trees to keep under `.ostia/ab`, counting this run's: after a
|
|
52
|
+
* run, older ones go, least recently used first, unless one was used in
|
|
53
|
+
* the last hour (another run may still need it). Default: 5. */
|
|
54
|
+
keepTrees?: number;
|
|
55
|
+
/** SIGKILLs a runner process (one suite file or repeat), or a `baseSetup`
|
|
56
|
+
* command, after this many ms. */
|
|
22
57
|
timeoutMs?: number;
|
|
23
|
-
/**
|
|
24
|
-
* `
|
|
25
|
-
|
|
58
|
+
/** Aborting kills the running process and resolves with the suites that
|
|
59
|
+
* had finished, plus an `aborted` warning; unrun repeats leave their
|
|
60
|
+
* workloads unconfirmed. */
|
|
61
|
+
signal?: AbortSignal;
|
|
62
|
+
/** Called as each setup command, task, confirmation repeat and memory
|
|
63
|
+
* process starts. */
|
|
64
|
+
onProgress?: (progress: AbProgress) => void;
|
|
26
65
|
}
|
|
27
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Launch settings for the suite files matching `suites`; see
|
|
68
|
+
* `BenchOptions.projects`. */
|
|
28
69
|
export interface BenchProject {
|
|
29
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* Globs against the current directory. A suite file takes the first
|
|
30
72
|
* project one of these matches; `ostia bench` with no files also runs
|
|
31
73
|
* every file they expand to. */
|
|
32
74
|
suites: string[];
|
|
33
|
-
/**
|
|
75
|
+
/**
|
|
76
|
+
* Replaces the top-level `preload` for these files; `[]` runs them with
|
|
34
77
|
* none. Unset: the top-level list applies. */
|
|
35
78
|
preload?: string[];
|
|
36
79
|
/** Replaces the top-level `bunFlags` for these files, as `preload` does. */
|
|
37
80
|
bunFlags?: string[];
|
|
38
81
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
timeoutMs?: number;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export interface AbConfig {
|
|
73
|
-
/** Shell command(s) run once in a freshly extracted base tree, e.g. to
|
|
74
|
-
* build gitignored files the suites import; see `AbOptions.baseSetup`.
|
|
75
|
-
* `--base-setup` replaces this list. */
|
|
76
|
-
setup?: string | string[];
|
|
77
|
-
/** Base trees to keep cached; see `AbOptions.keepTrees`. `--keep-trees`
|
|
78
|
-
* overrides. Default: 5. */
|
|
79
|
-
keepTrees?: number;
|
|
80
|
-
/** Judge rounds by `"time"` or `"instructions"`; see `AbOptions.metric`.
|
|
81
|
-
* `--metric` overrides. Default: `"time"`. */
|
|
82
|
-
metric?: "time" | "instructions";
|
|
83
|
-
/** Compare retained heap per call; see `AbOptions.alloc`. `--alloc` /
|
|
84
|
-
* `--no-alloc` override. `bench.alloc` doesn't apply to `ab`. */
|
|
85
|
-
alloc?: boolean;
|
|
86
|
-
/** Compare peak RSS of the first call; see `AbOptions.peakMem`.
|
|
87
|
-
* `--peak-mem` / `--no-peak-mem` override. `bench.peakMem` doesn't apply
|
|
88
|
-
* to `ab`. */
|
|
89
|
-
peakMem?: boolean;
|
|
90
|
-
/** Memory verdict threshold, percent; see `AbOptions.memThresholdPct`.
|
|
91
|
-
* `--mem-threshold` overrides. Default: 10. */
|
|
92
|
-
memThresholdPct?: number;
|
|
82
|
+
/** What `ab()` is doing, for `onProgress`. Counts start at 1. */
|
|
83
|
+
export type AbProgress = {
|
|
84
|
+
phase: "setup";
|
|
85
|
+
command: string;
|
|
86
|
+
} | {
|
|
87
|
+
phase: "measure";
|
|
88
|
+
suite: number;
|
|
89
|
+
suites: number;
|
|
90
|
+
file: string;
|
|
91
|
+
/** Each suite runs twice, once with each side first. */
|
|
92
|
+
pass: number;
|
|
93
|
+
passes: number;
|
|
94
|
+
task: number;
|
|
95
|
+
tasks: number;
|
|
96
|
+
label: string;
|
|
97
|
+
} | {
|
|
98
|
+
phase: "confirm";
|
|
99
|
+
repeat: number;
|
|
100
|
+
repeats: number;
|
|
101
|
+
label: string;
|
|
102
|
+
} | {
|
|
103
|
+
phase: "memory";
|
|
104
|
+
run: number;
|
|
105
|
+
runs: number;
|
|
106
|
+
side: Side;
|
|
107
|
+
label: string;
|
|
108
|
+
};
|
|
109
|
+
type Side = "base" | "cand";
|
|
110
|
+
/** `ab()` can't run: not in a git repository, or `base` isn't a commit. */
|
|
111
|
+
export declare class AbBaseError extends OstiaUsageError {
|
|
93
112
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
/** `command` workloads: sampling budget in ms; see `time()`. */
|
|
99
|
-
budgetMs?: number;
|
|
100
|
-
/** `command` workloads: floor on trials; see `time()`. */
|
|
101
|
-
minSamples?: number;
|
|
102
|
-
warmup: number;
|
|
103
|
-
outDir: string;
|
|
104
|
-
baselineDir: string;
|
|
105
|
-
baseline: string;
|
|
106
|
-
thresholds: Thresholds;
|
|
107
|
-
workloads: WorkloadConfig[];
|
|
108
|
-
bench?: BenchConfig;
|
|
109
|
-
ab?: AbConfig;
|
|
110
|
-
/** `ostia ci`'s policy for a workload with no matching baseline row (by
|
|
111
|
-
* workload id): `"fail"` exits 2 naming the baseline file, `"warn"` lists
|
|
112
|
-
* it in the report. Unset: `"fail"` when every workload is missing (a
|
|
113
|
-
* stale or wrong baseline), `"warn"` otherwise. */
|
|
114
|
-
onMissingBaseline?: "warn" | "fail";
|
|
115
|
-
/** Measure the machine's noise floor once per `ostia ci` run (default
|
|
116
|
-
* true) and stamp it on the candidate document, so `compare` widens its
|
|
117
|
-
* thresholds accordingly. `--no-noise-check` overrides this per run. */
|
|
118
|
-
noiseCheck?: boolean;
|
|
113
|
+
/** The caller's input can't be run as given (missing suite, bad ref, absent
|
|
114
|
+
* baseline): the CLI reports it as a usage error (exit 2) rather than an
|
|
115
|
+
* internal failure. */
|
|
116
|
+
declare class OstiaUsageError extends Error {
|
|
119
117
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
export interface Thresholds {
|
|
126
|
-
timingPct: number;
|
|
127
|
-
frameSelfPct: number;
|
|
128
|
-
heapTypePct: number;
|
|
129
|
-
minFrameSelfUs: number;
|
|
130
|
-
/** A `regressed` / `improved` verdict also requires Mann-Whitney `pValue < alpha`. */
|
|
131
|
-
alpha: number;
|
|
132
|
-
/** Bootstrap resample rounds for the timing CI. */
|
|
133
|
-
bootstrapIterations: number;
|
|
118
|
+
/** A `baseSetup` command exited non-zero or timed out. The message names
|
|
119
|
+
* the command and ends with the tail of its output. */
|
|
120
|
+
export declare class AbSetupError extends Error {
|
|
134
121
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
unmatched: {
|
|
141
|
-
baseOnly: Workload[];
|
|
142
|
-
candOnly: Workload[];
|
|
143
|
-
};
|
|
144
|
-
/** Every task on either side; see `ProfileDocument.compared`. */
|
|
145
|
-
compared: ComparedTask[];
|
|
146
|
-
summary: ComparisonSummary;
|
|
122
|
+
/** One side's suite failed outside any task: on import, with no tasks, or
|
|
123
|
+
* while a task's memory was measured. */
|
|
124
|
+
export declare class AbSuiteError extends Error {
|
|
125
|
+
readonly side: Side;
|
|
126
|
+
constructor(message: string, side: Side);
|
|
147
127
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
128
|
+
/** Paired A/B timing of suite files against a git ref: every task runs on
|
|
129
|
+
* the ref's committed tree (base) and the working tree (candidate) in one
|
|
130
|
+
* process, alternating short batches, and is judged on the per-round time
|
|
131
|
+
* ratio. Drift between two runs minutes apart cancels within a round. What
|
|
132
|
+
* pairing can't cancel is how the JIT compiled each side in that process,
|
|
133
|
+
* so every flagged workload is re-measured in `confirm` fresh processes
|
|
134
|
+
* and only counts when they all agree. */
|
|
135
|
+
export declare function ab(opts: AbOptions): Promise<ProfileDocument>;
|
|
151
136
|
export interface ProfileDocument {
|
|
152
137
|
schemaVersion: 2;
|
|
153
138
|
toolVersion: string;
|
|
@@ -163,76 +148,60 @@ export interface ProfileDocument {
|
|
|
163
148
|
comparisons?: Comparison[];
|
|
164
149
|
/** Aggregate across `comparisons`; present wherever `comparisons` is. */
|
|
165
150
|
comparisonSummary?: ComparisonSummary;
|
|
166
|
-
/**
|
|
151
|
+
/**
|
|
152
|
+
* Workload ids on only one side of the comparison; present wherever
|
|
167
153
|
* `comparisons` is. */
|
|
168
154
|
unmatched?: {
|
|
169
155
|
baseOnly: string[];
|
|
170
156
|
candOnly: string[];
|
|
171
157
|
};
|
|
172
|
-
/**
|
|
158
|
+
/**
|
|
159
|
+
* Every task on either side of the comparison, one entry each: what
|
|
173
160
|
* `--format markdown` prints, flat for scripts. Present wherever
|
|
174
161
|
* `comparisons` is. */
|
|
175
162
|
compared?: ComparedTask[];
|
|
176
|
-
/**
|
|
163
|
+
/**
|
|
164
|
+
* Machine conditions at measurement time; absent when the noise check was
|
|
177
165
|
* skipped. */
|
|
178
166
|
environment?: Environment;
|
|
179
|
-
/**
|
|
167
|
+
/**
|
|
168
|
+
* Run-level result of `ostia ab` / `ab()`, whose measurements are
|
|
180
169
|
* `phase: "paired"`. */
|
|
181
170
|
ab?: AbSummary;
|
|
182
|
-
/**
|
|
183
|
-
*
|
|
171
|
+
/**
|
|
172
|
+
* Repo state of the process's cwd; absent outside a git repo. Never part
|
|
173
|
+
* of an id or fingerprint, so a commit or dirty tree doesn't orphan a
|
|
174
|
+
* baseline. */
|
|
184
175
|
git?: GitMetadata;
|
|
185
176
|
}
|
|
186
|
-
|
|
187
|
-
interface GitMetadata {
|
|
188
|
-
sha: string;
|
|
189
|
-
branch: string;
|
|
190
|
-
dirty: boolean;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
interface NoiseFloor {
|
|
194
|
-
/** `mad / median` of a reference workload, percent: how noisy the machine is
|
|
195
|
-
* right now, independent of what's measured. */
|
|
196
|
-
floorPct: number;
|
|
197
|
-
referenceMedianNs: number;
|
|
198
|
-
samples: number;
|
|
199
|
-
/** How much slower (positive) the reference ran at the end of the run than
|
|
200
|
-
* at the start, percent: the machine's drift over the run. Absent when the
|
|
201
|
-
* run didn't re-measure it (`profile()`, older documents). */
|
|
202
|
-
driftPct?: number;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
interface Environment {
|
|
206
|
-
cpuModel: string;
|
|
207
|
-
cores: number;
|
|
208
|
-
loadAvg1: number;
|
|
209
|
-
loadAvg5: number;
|
|
210
|
-
noise: NoiseFloor;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
177
|
export interface Workload {
|
|
214
|
-
/**
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
178
|
+
/**
|
|
179
|
+
* Identifies what is measured, not where or when. Subprocess: a hash of
|
|
180
|
+
* argv, `prepare` and `timeSource`, excluding `process.cwd()`. In-process:
|
|
181
|
+
* a hash of the function source, or for a registry entry the file, task
|
|
182
|
+
* name and `params`. Annotations (`label`, `description`, `baseline`)
|
|
183
|
+
* never affect it. */
|
|
219
184
|
id: string;
|
|
220
185
|
kind: "subprocess" | "inprocess";
|
|
221
186
|
label?: string;
|
|
222
187
|
command?: string[];
|
|
223
|
-
/**
|
|
224
|
-
*
|
|
225
|
-
*
|
|
188
|
+
/**
|
|
189
|
+
* Command-form `prepare` hook run before every trial; part of the id. A
|
|
190
|
+
* function-form hook isn't serializable and is omitted (its source is
|
|
191
|
+
* still hashed into the id). */
|
|
226
192
|
prepare?: string[];
|
|
227
|
-
/**
|
|
193
|
+
/**
|
|
194
|
+
* Takes samples from a number in the command's own output instead of the
|
|
228
195
|
* wall clock; part of the id. */
|
|
229
196
|
timeSource?: {
|
|
230
197
|
pattern: string;
|
|
231
198
|
group?: number;
|
|
232
199
|
unit?: "ns" | "us" | "ms" | "s";
|
|
233
200
|
};
|
|
234
|
-
/**
|
|
235
|
-
* `
|
|
201
|
+
/**
|
|
202
|
+
* `task` is the registry's "group/name" id; `group` is the enclosing
|
|
203
|
+
* `group()` name. Renderers prefer `group` over splitting `task` on "/".
|
|
204
|
+
* */
|
|
236
205
|
entry?: {
|
|
237
206
|
file: string;
|
|
238
207
|
task: string;
|
|
@@ -246,21 +215,21 @@ export interface Workload {
|
|
|
246
215
|
groupDescription?: string;
|
|
247
216
|
/** Ran in a subprocess of its own rather than sharing its suite file's. */
|
|
248
217
|
isolated?: boolean;
|
|
249
|
-
/**
|
|
218
|
+
/**
|
|
219
|
+
* From `task(..., { params })` or a `sweep()` point. Part of the id, so
|
|
250
220
|
* points sharing a task name don't collide. */
|
|
251
221
|
params?: Record<string, string | number | boolean>;
|
|
252
|
-
/**
|
|
222
|
+
/**
|
|
223
|
+
* Ids this task had under its former names (`task(..., { aliases })`), so
|
|
253
224
|
* `compare` and `ab` match a base measured before a rename. Never part of
|
|
254
225
|
* the id. */
|
|
255
226
|
formerIds?: string[];
|
|
256
|
-
/**
|
|
257
|
-
*
|
|
258
|
-
* a
|
|
227
|
+
/**
|
|
228
|
+
* From `task.skip()` / `group.skip()`: never measured, so no
|
|
229
|
+
* `Measurement`. Renderers print a "- skipped" row; `compare` treats it as
|
|
230
|
+
* `unchanged` with a `skipped` warning. */
|
|
259
231
|
skipped?: boolean;
|
|
260
232
|
}
|
|
261
|
-
|
|
262
|
-
type Phase = "timing" | "cpu" | "heap" | "memstats" | "paired";
|
|
263
|
-
|
|
264
233
|
interface Measurement {
|
|
265
234
|
id: string;
|
|
266
235
|
workloadId: string;
|
|
@@ -274,12 +243,14 @@ interface Measurement {
|
|
|
274
243
|
heap?: HeapEvidence;
|
|
275
244
|
memory?: MemoryEvidence;
|
|
276
245
|
jit?: JitTierBreakdown;
|
|
277
|
-
/**
|
|
246
|
+
/**
|
|
247
|
+
* In-process timing, where the machine counts them: instructions the
|
|
278
248
|
* task retired per call, one sample per trial (see `InstructionStats`). */
|
|
279
249
|
instructions?: InstructionStats;
|
|
280
250
|
/** `phase: "paired"` only; `timing` is then the candidate side. */
|
|
281
251
|
paired?: PairedEvidence;
|
|
282
|
-
/**
|
|
252
|
+
/**
|
|
253
|
+
* `phase: "paired"` only: the task threw on one side or both
|
|
283
254
|
* (`"both"`). Usually instead of `timing`/`paired`; when it threw in a
|
|
284
255
|
* confirmation repeat, `repeat` (from 1) says which, and `timing`/`paired`
|
|
285
256
|
* stay as the first process measured them. Either way the task isn't in
|
|
@@ -291,15 +262,17 @@ interface Measurement {
|
|
|
291
262
|
};
|
|
292
263
|
warnings: Warning[];
|
|
293
264
|
artifacts: ArtifactRef[];
|
|
294
|
-
/**
|
|
295
|
-
*
|
|
265
|
+
/**
|
|
266
|
+
* Trials ran round-robin with the other commands of the same `time()`
|
|
267
|
+
* call, so drift over the run hits every command equally. */
|
|
296
268
|
interleaved?: boolean;
|
|
297
269
|
}
|
|
298
|
-
|
|
270
|
+
type Phase = "timing" | "cpu" | "heap" | "memstats" | "paired";
|
|
299
271
|
interface Trial {
|
|
300
272
|
i: number;
|
|
301
273
|
wallNs: number;
|
|
302
|
-
/**
|
|
274
|
+
/**
|
|
275
|
+
* The command's self-reported time (ns) under a `timeSource`; these, not
|
|
303
276
|
* `wallNs`, are then the `timing.samples`. */
|
|
304
277
|
reportedNs?: number;
|
|
305
278
|
exitCode?: number;
|
|
@@ -308,11 +281,11 @@ interface Trial {
|
|
|
308
281
|
maxRssBytes?: number;
|
|
309
282
|
/** Killed by `timeoutMs`; `exitCode` is absent. Contributes no sample. */
|
|
310
283
|
timedOut?: true;
|
|
311
|
-
/**
|
|
284
|
+
/**
|
|
285
|
+
* Output didn't match the `timeSource` pattern; `reportedNs` is absent
|
|
312
286
|
* (never a `wallNs` fallback). Contributes no sample. */
|
|
313
287
|
timeSourceNoMatch?: true;
|
|
314
288
|
}
|
|
315
|
-
|
|
316
289
|
interface TimingStats {
|
|
317
290
|
unit: "ns";
|
|
318
291
|
samples: number[];
|
|
@@ -331,19 +304,26 @@ interface TimingStats {
|
|
|
331
304
|
p75: number;
|
|
332
305
|
/** 99th percentile, ns. */
|
|
333
306
|
p99: number;
|
|
334
|
-
/**
|
|
307
|
+
/**
|
|
308
|
+
* Median absolute deviation, ns: a spread measure that, unlike stddev, the
|
|
335
309
|
* long right tail of wall-clock timings doesn't skew. */
|
|
336
310
|
mad: number;
|
|
337
|
-
/**
|
|
311
|
+
/**
|
|
312
|
+
* Calls batched into one timed block; absent (read as 1) unless batching
|
|
338
313
|
* occurred, and always absent for subprocess timing. */
|
|
339
314
|
batch?: number;
|
|
340
315
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
316
|
+
interface CpuEvidence {
|
|
317
|
+
origin: "cpu-prof" | "inspector" | "jsc-profile";
|
|
318
|
+
samplingIntervalUs: number;
|
|
319
|
+
frames: Frame[];
|
|
320
|
+
nodes: CallNode[];
|
|
321
|
+
totals: FrameTotal[];
|
|
322
|
+
samples?: {
|
|
323
|
+
nodeIds: number[];
|
|
324
|
+
timeDeltasUs: number[];
|
|
325
|
+
};
|
|
345
326
|
}
|
|
346
|
-
|
|
347
327
|
interface Frame {
|
|
348
328
|
key: string;
|
|
349
329
|
name: string;
|
|
@@ -351,32 +331,17 @@ interface Frame {
|
|
|
351
331
|
line?: number;
|
|
352
332
|
col?: number;
|
|
353
333
|
}
|
|
354
|
-
|
|
355
334
|
interface CallNode {
|
|
356
335
|
id: number;
|
|
357
336
|
frameIx: number;
|
|
358
337
|
children: number[];
|
|
359
338
|
}
|
|
360
|
-
|
|
361
339
|
interface FrameTotal {
|
|
362
340
|
frameIx: number;
|
|
363
341
|
selfUs: number;
|
|
364
342
|
totalUs: number;
|
|
365
343
|
samples: number;
|
|
366
344
|
}
|
|
367
|
-
|
|
368
|
-
interface CpuEvidence {
|
|
369
|
-
origin: "cpu-prof" | "inspector" | "jsc-profile";
|
|
370
|
-
samplingIntervalUs: number;
|
|
371
|
-
frames: Frame[];
|
|
372
|
-
nodes: CallNode[];
|
|
373
|
-
totals: FrameTotal[];
|
|
374
|
-
samples?: {
|
|
375
|
-
nodeIds: number[];
|
|
376
|
-
timeDeltasUs: number[];
|
|
377
|
-
};
|
|
378
|
-
}
|
|
379
|
-
|
|
380
345
|
interface HeapEvidence {
|
|
381
346
|
origin: "heap-prof";
|
|
382
347
|
heapSizeBytes?: number;
|
|
@@ -387,27 +352,30 @@ interface HeapEvidence {
|
|
|
387
352
|
retainedBytes?: number;
|
|
388
353
|
}[];
|
|
389
354
|
}
|
|
390
|
-
|
|
391
355
|
interface MemoryEvidence {
|
|
392
356
|
origin: "resourceUsage" | "heapStats";
|
|
393
|
-
/**
|
|
394
|
-
* (`--
|
|
357
|
+
/**
|
|
358
|
+
* `memstats` only: `"retained"` (`--alloc`, `bytesPerOp`) or `"peak"`
|
|
359
|
+
* (`--peak-mem`, `peakBytes`). Absent means `"retained"` on older
|
|
360
|
+
* documents. */
|
|
395
361
|
kind?: "retained" | "peak";
|
|
396
362
|
/** Largest `Trial.maxRssBytes` across a timing measurement's trials. */
|
|
397
363
|
maxRssBytes?: number;
|
|
398
|
-
/**
|
|
364
|
+
/**
|
|
365
|
+
* `--alloc`: heap growth per call across one batch bracketed by full GCs,
|
|
399
366
|
* so what the calls keep alive (a leak check), not what they allocate. */
|
|
400
367
|
bytesPerOp?: number;
|
|
401
|
-
/**
|
|
368
|
+
/**
|
|
369
|
+
* `--peak-mem`: how far one call raised RSS, garbage included; median over
|
|
402
370
|
* 3 fresh processes. A `peak-hidden` warning says when it may read low. */
|
|
403
371
|
peakBytes?: number;
|
|
404
|
-
/**
|
|
372
|
+
/**
|
|
373
|
+
* In-process timing: the JS heap's size as of its last collection, just
|
|
405
374
|
* before the task's warmup and just after its last trial. Read without
|
|
406
375
|
* forcing a GC, so it never perturbs the timing. */
|
|
407
376
|
heapUsedBeforeBytes?: number;
|
|
408
377
|
heapUsedAfterBytes?: number;
|
|
409
378
|
}
|
|
410
|
-
|
|
411
379
|
interface JitTierBreakdown {
|
|
412
380
|
origin: "jsc-profile";
|
|
413
381
|
tiers: {
|
|
@@ -422,13 +390,26 @@ interface JitTierBreakdown {
|
|
|
422
390
|
samples: number;
|
|
423
391
|
}[];
|
|
424
392
|
}
|
|
425
|
-
|
|
393
|
+
/**
|
|
394
|
+
* Instructions retired per call on the thread that ran the task, in user
|
|
395
|
+
* mode: a system call's kernel work and other threads' (JIT compiler, GC
|
|
396
|
+
* helpers, I/O pool) don't count. Unlike time, another process taking the
|
|
397
|
+
* CPU doesn't move it. Includes the timing loop's own few hundred
|
|
398
|
+
* instructions per batch. */
|
|
399
|
+
interface InstructionStats {
|
|
400
|
+
samples: number[];
|
|
401
|
+
median: number;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Evidence of a `phase: "paired"` measurement: base and candidate
|
|
405
|
+
* alternate in batches in one process, so drift cancels in the ratio. */
|
|
426
406
|
interface PairedEvidence {
|
|
427
407
|
/** One base batch and one candidate batch per round, alternating order. */
|
|
428
408
|
rounds: number;
|
|
429
409
|
/** Calls per side per round. */
|
|
430
410
|
batch: number;
|
|
431
|
-
/**
|
|
411
|
+
/**
|
|
412
|
+
* Base per-call time for each round, ns; `ratios[i]` pairs with
|
|
432
413
|
* `baseSamples[i]` and the candidate's `timing.samples[i]`. */
|
|
433
414
|
baseSamples: number[];
|
|
434
415
|
baseMedianNs: number;
|
|
@@ -438,13 +419,16 @@ interface PairedEvidence {
|
|
|
438
419
|
/** 25th/75th percentile of `ratios`. */
|
|
439
420
|
ratioP25: number;
|
|
440
421
|
ratioP75: number;
|
|
441
|
-
/**
|
|
422
|
+
/**
|
|
423
|
+
* Instructions retired per call on each side, where the machine counts
|
|
442
424
|
* them; what `AbSummary.metric: "instructions"` judges. */
|
|
443
425
|
instructions?: PairedInstructions;
|
|
444
|
-
/**
|
|
426
|
+
/**
|
|
427
|
+
* `AbSummary.metric`'s median ratio past `1 ± threshold` and on the same
|
|
445
428
|
* side of 1 in at least three quarters of rounds. */
|
|
446
429
|
flagged?: "regressed" | "improved";
|
|
447
|
-
/**
|
|
430
|
+
/**
|
|
431
|
+
* Each fresh-process re-measurement of a flagged workload; `flagged` by
|
|
448
432
|
* `AbSummary.metric`. */
|
|
449
433
|
repeats?: {
|
|
450
434
|
medianRatio: number;
|
|
@@ -461,22 +445,28 @@ interface PairedEvidence {
|
|
|
461
445
|
confirmed?: boolean;
|
|
462
446
|
/** `flagged` when confirmed, else `"unchanged"`. */
|
|
463
447
|
verdict: "regressed" | "improved" | "unchanged";
|
|
464
|
-
/**
|
|
448
|
+
/**
|
|
449
|
+
* First call's return values were deep-equal on both sides; informational,
|
|
465
450
|
* never a failure. */
|
|
466
451
|
sameOutput: boolean;
|
|
467
|
-
/**
|
|
452
|
+
/**
|
|
453
|
+
* Set when the suite file's text differs from the base ref's copy, so
|
|
468
454
|
* each side may run a different benchmark (a fixed fixture, a changed
|
|
469
455
|
* input). With `sameOutput: false` too, the task is "not comparable": its
|
|
470
456
|
* verdict is `"unchanged"` and it's left out of the geomean. */
|
|
471
457
|
suiteChanged?: true;
|
|
472
|
-
/**
|
|
458
|
+
/**
|
|
459
|
+
* `--alloc`: heap each call keeps alive after a full GC, per side, after
|
|
473
460
|
* a warmup batch; each the median of 3 fresh processes. */
|
|
474
461
|
retained?: MemoryChange;
|
|
475
|
-
/**
|
|
462
|
+
/**
|
|
463
|
+
* `--peak-mem`: how far the task's first call raises RSS, per side,
|
|
476
464
|
* each the median of 3 fresh processes. */
|
|
477
465
|
peak?: MemoryChange;
|
|
478
466
|
}
|
|
479
|
-
|
|
467
|
+
/**
|
|
468
|
+
* Instructions a paired task retired per call (see `InstructionStats`),
|
|
469
|
+
* from the same rounds as `PairedEvidence`'s times. */
|
|
480
470
|
interface PairedInstructions {
|
|
481
471
|
/** Per round, index-aligned with `PairedEvidence.baseSamples`. */
|
|
482
472
|
baseSamples: number[];
|
|
@@ -489,78 +479,49 @@ interface PairedInstructions {
|
|
|
489
479
|
ratioP25: number;
|
|
490
480
|
ratioP75: number;
|
|
491
481
|
}
|
|
492
|
-
|
|
482
|
+
/** One memory reading on both sides of an `ab()` task, bytes. */
|
|
493
483
|
interface MemoryChange {
|
|
494
484
|
baseBytes: number;
|
|
495
485
|
candBytes: number;
|
|
496
|
-
/**
|
|
486
|
+
/**
|
|
487
|
+
* Past both `AbSummary.memory.thresholdPct` of the base and
|
|
497
488
|
* `floorBytes`; always `"unchanged"` on a not-comparable task. */
|
|
498
489
|
verdict: "regressed" | "improved" | "unchanged";
|
|
499
|
-
/**
|
|
490
|
+
/**
|
|
491
|
+
* The smallest change that counts, bytes: 16 KiB over the batch's calls
|
|
500
492
|
* for `retained`; for `peak`, 1 MiB, or the freed memory a `peak-hidden`
|
|
501
493
|
* warning reports. */
|
|
502
494
|
floorBytes: number;
|
|
503
495
|
}
|
|
504
|
-
|
|
505
|
-
interface AbSummary {
|
|
506
|
-
base: {
|
|
507
|
-
ref: string;
|
|
508
|
-
sha: string;
|
|
509
|
-
};
|
|
510
|
-
/** Suite files, as given, that don't exist at the base ref: their tasks
|
|
511
|
-
* are all candidate-only. */
|
|
512
|
-
newSuites?: string[];
|
|
513
|
-
rounds: number;
|
|
514
|
-
/** What verdicts, confirmation and `geomeanPct` judge: each round's time
|
|
515
|
-
* ratio, or its instruction ratio (`PairedEvidence.instructions`). */
|
|
516
|
-
metric: "time" | "instructions";
|
|
517
|
-
thresholdPct: number;
|
|
518
|
-
geomeanThresholdPct: number;
|
|
519
|
-
/** Workloads measured on both sides. */
|
|
520
|
-
matched: number;
|
|
521
|
-
/** Confirmed verdicts. */
|
|
522
|
-
regressed: number;
|
|
523
|
-
improved: number;
|
|
524
|
-
unchanged: number;
|
|
525
|
-
/** Flagged in-process, but a fresh-process repeat disagreed; counted in
|
|
526
|
-
* `unchanged`. */
|
|
527
|
-
unconfirmed: number;
|
|
528
|
-
/** Workloads whose first call returned different values on each side. */
|
|
529
|
-
outputDiffers: number;
|
|
530
|
-
/** Workloads whose suite file and output both changed (see
|
|
531
|
-
* `PairedEvidence.suiteChanged`); counted in `unchanged`, left out of
|
|
532
|
-
* `geomeanPct`. */
|
|
533
|
-
notComparable: number;
|
|
534
|
-
/** Workloads that threw on either side or both, and so weren't timed;
|
|
535
|
-
* not counted in `matched`. */
|
|
536
|
-
threw: number;
|
|
537
|
-
/** Present when any task had a memory reading (`--alloc`, `--peak-mem`):
|
|
538
|
-
* how many tasks' memory regressed or improved, on either reading. */
|
|
539
|
-
memory?: {
|
|
540
|
-
thresholdPct: number;
|
|
541
|
-
regressed: number;
|
|
542
|
-
improved: number;
|
|
543
|
-
};
|
|
544
|
-
/** Geometric mean of the workloads' median `metric` ratios, signed
|
|
545
|
-
* percent (negative: candidate faster); a flagged workload contributes its
|
|
546
|
-
* median over its main run and repeats. `null` when nothing was paired. */
|
|
547
|
-
geomeanPct: number | null;
|
|
548
|
-
/** `"fail"` when any workload regressed (confirmed), threw on the
|
|
549
|
-
* candidate side only, or `geomeanPct` exceeds `geomeanThresholdPct`, or
|
|
550
|
-
* any task's memory regressed. */
|
|
551
|
-
verdict: "pass" | "fail";
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
declare const WARNING_CODES: readonly ["slow-first-run", "outliers-detected", "fast-command", "nonzero-exit", "artifact-missing", "empty-profile", "low-sample-count", "thin-comparison", "noisy-machine", "skipped", "jit-cold", "timeout", "aborted", "time-source-no-match", "environment-mismatch", "peak-hidden", "suite-changed"];
|
|
555
|
-
|
|
556
|
-
export type WarningCode = (typeof WARNING_CODES)[number];
|
|
557
|
-
|
|
558
496
|
export interface Warning {
|
|
559
497
|
code: WarningCode;
|
|
560
498
|
message: string;
|
|
561
499
|
data?: Record<string, unknown>;
|
|
562
500
|
}
|
|
563
|
-
|
|
501
|
+
export type WarningCode = (typeof WARNING_CODES)[number];
|
|
502
|
+
/**
|
|
503
|
+
* Every `Warning.code`. A runtime array so a test can assert each is
|
|
504
|
+
* emitted.
|
|
505
|
+
*/
|
|
506
|
+
declare const WARNING_CODES: readonly [
|
|
507
|
+
"slow-first-run",
|
|
508
|
+
"outliers-detected",
|
|
509
|
+
"fast-command",
|
|
510
|
+
"nonzero-exit",
|
|
511
|
+
"artifact-missing",
|
|
512
|
+
"empty-profile",
|
|
513
|
+
"low-sample-count",
|
|
514
|
+
"thin-comparison",
|
|
515
|
+
"noisy-machine",
|
|
516
|
+
"skipped",
|
|
517
|
+
"jit-cold",
|
|
518
|
+
"timeout",
|
|
519
|
+
"aborted",
|
|
520
|
+
"time-source-no-match",
|
|
521
|
+
"environment-mismatch",
|
|
522
|
+
"peak-hidden",
|
|
523
|
+
"suite-changed"
|
|
524
|
+
];
|
|
564
525
|
interface ArtifactRef {
|
|
565
526
|
id: string;
|
|
566
527
|
kind: "cpuprofile" | "heapsnapshot";
|
|
@@ -568,7 +529,6 @@ interface ArtifactRef {
|
|
|
568
529
|
sha256: string;
|
|
569
530
|
bytes: number;
|
|
570
531
|
}
|
|
571
|
-
|
|
572
532
|
export interface Comparison {
|
|
573
533
|
id: string;
|
|
574
534
|
baselineMeasurementId: string;
|
|
@@ -576,7 +536,8 @@ export interface Comparison {
|
|
|
576
536
|
timing?: {
|
|
577
537
|
medianDeltaPct: number;
|
|
578
538
|
meanDeltaPct: number;
|
|
579
|
-
/**
|
|
539
|
+
/**
|
|
540
|
+
* 95% bootstrap CI on the difference of medians, percent of the baseline
|
|
580
541
|
* median. Absent below 5 samples a side (`thin-comparison`). */
|
|
581
542
|
ci95?: [number, number];
|
|
582
543
|
/** Two-sided Mann-Whitney U p-value; absent whenever `ci95` is. */
|
|
@@ -585,7 +546,10 @@ export interface Comparison {
|
|
|
585
546
|
seed?: number;
|
|
586
547
|
verdict: "improved" | "regressed" | "unchanged";
|
|
587
548
|
};
|
|
588
|
-
/**
|
|
549
|
+
/**
|
|
550
|
+
* Caveats about this comparison, e.g. a thin-sample point-estimate
|
|
551
|
+
* verdict.
|
|
552
|
+
*/
|
|
589
553
|
warnings?: Warning[];
|
|
590
554
|
frames?: {
|
|
591
555
|
frameKey: string;
|
|
@@ -609,25 +573,31 @@ export interface Comparison {
|
|
|
609
573
|
minFrameSelfUs: number;
|
|
610
574
|
alpha: number;
|
|
611
575
|
bootstrapIterations: number;
|
|
612
|
-
/**
|
|
576
|
+
/**
|
|
577
|
+
* `max(timingPct, both documents' noise floors)`: what timing was tested
|
|
578
|
+
* against.
|
|
579
|
+
*/
|
|
613
580
|
effectiveTimingPct: number;
|
|
614
581
|
};
|
|
615
582
|
verdict: "pass" | "fail";
|
|
616
583
|
}
|
|
617
|
-
|
|
584
|
+
/** Aggregate view over a `compareDocuments` call's `Comparison[]`. */
|
|
618
585
|
interface ComparisonSummary {
|
|
619
586
|
/** `comparisons.length`. */
|
|
620
587
|
matched: number;
|
|
621
588
|
regressed: number;
|
|
622
589
|
improved: number;
|
|
623
590
|
unchanged: number;
|
|
624
|
-
/**
|
|
591
|
+
/**
|
|
592
|
+
* Geometric mean of `cand/base` median ratios, signed percent (negative:
|
|
625
593
|
* candidate faster). `null` when no comparison had a finite ratio. */
|
|
626
594
|
geomeanPct: number | null;
|
|
627
|
-
/**
|
|
595
|
+
/**
|
|
596
|
+
* `Comparison.thresholds.effectiveTimingPct`, which is the same for the
|
|
628
597
|
* whole document pair. */
|
|
629
598
|
effectiveTimingPct: number;
|
|
630
|
-
/**
|
|
599
|
+
/**
|
|
600
|
+
* The machine's drift, percent, added to the timing threshold: the
|
|
631
601
|
* largest of each run's own drift (`NoiseFloor.driftPct`) and how far the
|
|
632
602
|
* reference loop's speed moved between the two runs. Absent when either
|
|
633
603
|
* document lacks a noise check. */
|
|
@@ -635,24 +605,30 @@ interface ComparisonSummary {
|
|
|
635
605
|
/** `"fail"` when any comparison's verdict is `"fail"`. */
|
|
636
606
|
verdict: "pass" | "fail";
|
|
637
607
|
}
|
|
638
|
-
|
|
608
|
+
/**
|
|
609
|
+
* One task of a `compare`/`ci` run: matched on both sides, or present on
|
|
610
|
+
* only one (`missing-base`: new, or renamed without an alias;
|
|
611
|
+
* `missing-cand`: removed, or renamed). Times in ns, memory in bytes. */
|
|
639
612
|
interface ComparedTask {
|
|
640
613
|
/** The candidate's workload id; the base's on a `missing-cand` task. */
|
|
641
614
|
workloadId: string;
|
|
642
615
|
/** Display name: the label, else the command, else the id. */
|
|
643
616
|
task: string;
|
|
644
617
|
group?: string;
|
|
645
|
-
/**
|
|
618
|
+
/**
|
|
619
|
+
* Set when the base was matched through one of the task's `aliases`: the
|
|
646
620
|
* base's workload id and display name. */
|
|
647
621
|
renamedFrom?: {
|
|
648
622
|
workloadId: string;
|
|
649
623
|
task: string;
|
|
650
624
|
};
|
|
651
625
|
verdict: "improved" | "unchanged" | "regressed" | "missing-base" | "missing-cand";
|
|
652
|
-
/**
|
|
626
|
+
/**
|
|
627
|
+
* The `Comparison` holding this task's frame and heap-type deltas and
|
|
653
628
|
* warnings; absent on a one-sided task. */
|
|
654
629
|
comparisonId?: string;
|
|
655
|
-
/**
|
|
630
|
+
/**
|
|
631
|
+
* Whether the comparison passed the gate (timing, frames, heap types);
|
|
656
632
|
* absent on a one-sided task, which never fails it. */
|
|
657
633
|
pass?: boolean;
|
|
658
634
|
/** Absent on a one-sided or skipped task. */
|
|
@@ -673,9 +649,10 @@ interface ComparedTask {
|
|
|
673
649
|
/** Memory readings present on both sides; informational, never gated. */
|
|
674
650
|
memory?: MemoryDelta[];
|
|
675
651
|
}
|
|
676
|
-
|
|
652
|
+
/** One memory reading of a task on both sides of a `compare`/`ci`, bytes. */
|
|
677
653
|
interface MemoryDelta {
|
|
678
|
-
/**
|
|
654
|
+
/**
|
|
655
|
+
* `heapUsedBefore`/`heapUsedAfter`: in-process heap around the timing
|
|
679
656
|
* run; `retained`: `--alloc`; `peak`: `--peak-mem`; `maxRss`: subprocess
|
|
680
657
|
* timing. */
|
|
681
658
|
reading: "heapUsedBefore" | "heapUsedAfter" | "retained" | "peak" | "maxRss";
|
|
@@ -683,135 +660,88 @@ interface MemoryDelta {
|
|
|
683
660
|
candBytes: number;
|
|
684
661
|
deltaPct: number;
|
|
685
662
|
}
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
export type PrepareFn = (run: PrepareRun) => unknown;
|
|
693
|
-
|
|
694
|
-
export type PrepareHook = string | string[] | PrepareFn;
|
|
695
|
-
|
|
696
|
-
export type TimeUnit = "ns" | "us" | "ms" | "s";
|
|
697
|
-
|
|
698
|
-
export interface TimeSource {
|
|
699
|
-
pattern: string | RegExp;
|
|
700
|
-
group?: number;
|
|
701
|
-
unit?: TimeUnit;
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
export type AbProgress = {
|
|
705
|
-
phase: "setup";
|
|
706
|
-
command: string;
|
|
707
|
-
} | {
|
|
708
|
-
phase: "measure";
|
|
709
|
-
suite: number;
|
|
710
|
-
suites: number;
|
|
711
|
-
file: string;
|
|
712
|
-
/** Each suite runs twice, once with each side first. */
|
|
713
|
-
pass: number;
|
|
714
|
-
passes: number;
|
|
715
|
-
task: number;
|
|
716
|
-
tasks: number;
|
|
717
|
-
label: string;
|
|
718
|
-
} | {
|
|
719
|
-
phase: "confirm";
|
|
720
|
-
repeat: number;
|
|
721
|
-
repeats: number;
|
|
722
|
-
label: string;
|
|
723
|
-
} | {
|
|
724
|
-
phase: "memory";
|
|
725
|
-
run: number;
|
|
726
|
-
runs: number;
|
|
727
|
-
side: Side;
|
|
728
|
-
label: string;
|
|
729
|
-
};
|
|
730
|
-
|
|
731
|
-
export interface AbOptions {
|
|
732
|
-
suites: string[];
|
|
733
|
-
/** Git ref whose committed tree is the base side (default: `"HEAD"`); the
|
|
734
|
-
* candidate is the working tree, uncommitted changes included. */
|
|
735
|
-
base?: string;
|
|
736
|
-
/** Rounds per workload, each one base batch and one candidate batch of
|
|
737
|
-
* about 10ms (default: 15). */
|
|
738
|
-
rounds?: number;
|
|
739
|
-
/** What to judge each round by: the candidate/base time ratio
|
|
740
|
-
* (`"time"`, the default), or the ratio of instructions each side retired
|
|
741
|
-
* per call (`"instructions"`), which a loaded machine barely moves, so a
|
|
742
|
-
* lower `thresholdPct` holds. Instructions are recorded either way where
|
|
743
|
-
* the machine counts them (see `PairedEvidence.instructions`); asking to
|
|
744
|
-
* judge by them where it can't throws an `OstiaUsageError`. */
|
|
745
|
-
metric?: "time" | "instructions";
|
|
746
|
-
/** Flag a workload whose median candidate/base ratio moves past this many
|
|
747
|
-
* percent (default: 10). */
|
|
748
|
-
thresholdPct?: number;
|
|
749
|
-
/** Fail when the geometric mean of all workloads' ratios is slower than
|
|
750
|
-
* this many percent (default: 1.5): a broad slowdown too small to flag any
|
|
751
|
-
* one workload. */
|
|
752
|
-
geomeanThresholdPct?: number;
|
|
753
|
-
/** Fresh-process repeats of each flagged workload, which only counts when
|
|
754
|
-
* every repeat flags it the same way (default: 2; 0 trusts the first). */
|
|
755
|
-
confirm?: number;
|
|
756
|
-
filter?: string;
|
|
757
|
-
preload?: string[];
|
|
758
|
-
bunFlags?: string[];
|
|
759
|
-
/** Per-suite `preload` / `bunFlags`; see `BenchOptions.projects`. */
|
|
760
|
-
projects?: BenchProject[];
|
|
761
|
-
outDir?: string;
|
|
762
|
-
cwd?: string;
|
|
763
|
-
noiseCheck?: boolean;
|
|
764
|
-
/** Also compare each side's retained heap per call (see
|
|
765
|
-
* `bench({ alloc })`) and how far its first call raises RSS (see
|
|
766
|
-
* `bench({ peakMem })`), each the median of 3 fresh processes per side.
|
|
767
|
-
* Task/group options override these. */
|
|
768
|
-
alloc?: boolean;
|
|
769
|
-
peakMem?: boolean;
|
|
770
|
-
/** Flag a memory reading that moves past this many percent of the base's
|
|
771
|
-
* and past its noise floor (default: 10). A memory regression fails the
|
|
772
|
-
* run. */
|
|
773
|
-
memThresholdPct?: number;
|
|
774
|
-
/** Shell commands run once, in order, in a freshly extracted base tree
|
|
775
|
-
* before it's used: to build what the suites import but git doesn't hold
|
|
776
|
-
* (generated or gitignored files). Each runs with its cwd at the tree's
|
|
777
|
-
* counterpart of `cwd`, the project's `node_modules` linked in, and
|
|
778
|
-
* `OSTIA_AB_SHA` / `OSTIA_AB_CANDIDATE_DIR` (the working tree's `cwd`) in
|
|
779
|
-
* its environment. The tree is cached per commit and command list. */
|
|
780
|
-
baseSetup?: string | string[];
|
|
781
|
-
/** Base trees to keep under `.ostia/ab`, counting this run's: after a
|
|
782
|
-
* run, older ones go, least recently used first, unless one was used in
|
|
783
|
-
* the last hour (another run may still need it). Default: 5. */
|
|
784
|
-
keepTrees?: number;
|
|
785
|
-
/** SIGKILLs a runner process (one suite file or repeat), or a `baseSetup`
|
|
786
|
-
* command, after this many ms. */
|
|
787
|
-
timeoutMs?: number;
|
|
788
|
-
/** Aborting kills the running process and resolves with the suites that
|
|
789
|
-
* had finished, plus an `aborted` warning; unrun repeats leave their
|
|
790
|
-
* workloads unconfirmed. */
|
|
791
|
-
signal?: AbortSignal;
|
|
792
|
-
/** Called as each setup command, task, confirmation repeat and memory
|
|
793
|
-
* process starts. */
|
|
794
|
-
onProgress?: (progress: AbProgress) => void;
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
export declare class AbBaseError extends OstiaUsageError {
|
|
663
|
+
interface Environment {
|
|
664
|
+
cpuModel: string;
|
|
665
|
+
cores: number;
|
|
666
|
+
loadAvg1: number;
|
|
667
|
+
loadAvg5: number;
|
|
668
|
+
noise: NoiseFloor;
|
|
798
669
|
}
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
670
|
+
interface NoiseFloor {
|
|
671
|
+
/**
|
|
672
|
+
* `mad / median` of a reference workload, percent: how noisy the machine
|
|
673
|
+
* is right now, independent of what's measured. */
|
|
674
|
+
floorPct: number;
|
|
675
|
+
referenceMedianNs: number;
|
|
676
|
+
samples: number;
|
|
677
|
+
/**
|
|
678
|
+
* How much slower (positive) the reference ran at the end of the run than
|
|
679
|
+
* at the start, percent: the machine's drift over the run. Absent when the
|
|
680
|
+
* run didn't re-measure it (`profile()`, older documents). */
|
|
681
|
+
driftPct?: number;
|
|
803
682
|
}
|
|
804
|
-
|
|
805
|
-
|
|
683
|
+
/** Run-level result of `ab()`, stamped on the document as `ab`. */
|
|
684
|
+
interface AbSummary {
|
|
685
|
+
base: {
|
|
686
|
+
ref: string;
|
|
687
|
+
sha: string;
|
|
688
|
+
};
|
|
689
|
+
/**
|
|
690
|
+
* Suite files, as given, that don't exist at the base ref: their tasks
|
|
691
|
+
* are all candidate-only. */
|
|
692
|
+
newSuites?: string[];
|
|
693
|
+
rounds: number;
|
|
694
|
+
/**
|
|
695
|
+
* What verdicts, confirmation and `geomeanPct` judge: each round's time
|
|
696
|
+
* ratio, or its instruction ratio (`PairedEvidence.instructions`). */
|
|
697
|
+
metric: "time" | "instructions";
|
|
698
|
+
thresholdPct: number;
|
|
699
|
+
geomeanThresholdPct: number;
|
|
700
|
+
/** Workloads measured on both sides. */
|
|
701
|
+
matched: number;
|
|
702
|
+
/** Confirmed verdicts. */
|
|
703
|
+
regressed: number;
|
|
704
|
+
improved: number;
|
|
705
|
+
unchanged: number;
|
|
706
|
+
/**
|
|
707
|
+
* Flagged in-process, but a fresh-process repeat disagreed; counted in
|
|
708
|
+
* `unchanged`. */
|
|
709
|
+
unconfirmed: number;
|
|
710
|
+
/** Workloads whose first call returned different values on each side. */
|
|
711
|
+
outputDiffers: number;
|
|
712
|
+
/**
|
|
713
|
+
* Workloads whose suite file and output both changed (see
|
|
714
|
+
* `PairedEvidence.suiteChanged`); counted in `unchanged`, left out of
|
|
715
|
+
* `geomeanPct`. */
|
|
716
|
+
notComparable: number;
|
|
717
|
+
/**
|
|
718
|
+
* Workloads that threw on either side or both, and so weren't timed;
|
|
719
|
+
* not counted in `matched`. */
|
|
720
|
+
threw: number;
|
|
721
|
+
/**
|
|
722
|
+
* Present when any task had a memory reading (`--alloc`, `--peak-mem`):
|
|
723
|
+
* how many tasks' memory regressed or improved, on either reading. */
|
|
724
|
+
memory?: {
|
|
725
|
+
thresholdPct: number;
|
|
726
|
+
regressed: number;
|
|
727
|
+
improved: number;
|
|
728
|
+
};
|
|
729
|
+
/**
|
|
730
|
+
* Geometric mean of the workloads' median `metric` ratios, signed
|
|
731
|
+
* percent (negative: candidate faster); a flagged workload contributes its
|
|
732
|
+
* median over its main run and repeats. `null` when nothing was paired. */
|
|
733
|
+
geomeanPct: number | null;
|
|
734
|
+
/**
|
|
735
|
+
* `"fail"` when any workload regressed (confirmed), threw on the
|
|
736
|
+
* candidate side only, or `geomeanPct` exceeds `geomeanThresholdPct`, or
|
|
737
|
+
* any task's memory regressed. */
|
|
738
|
+
verdict: "pass" | "fail";
|
|
806
739
|
}
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
740
|
+
interface GitMetadata {
|
|
741
|
+
sha: string;
|
|
742
|
+
branch: string;
|
|
743
|
+
dirty: boolean;
|
|
811
744
|
}
|
|
812
|
-
|
|
813
|
-
type Side = "base" | "cand";
|
|
814
|
-
|
|
815
745
|
export interface BenchOptions {
|
|
816
746
|
suites: string[];
|
|
817
747
|
/** Wall-clock sampling budget per task, ms (default 500). */
|
|
@@ -820,184 +750,224 @@ export interface BenchOptions {
|
|
|
820
750
|
samples?: number;
|
|
821
751
|
minSamples?: number;
|
|
822
752
|
gc?: boolean;
|
|
823
|
-
/**
|
|
753
|
+
/**
|
|
754
|
+
* Capture one extra `phase: "cpu"` measurement per task (the task looped
|
|
824
755
|
* under the JSC sampling profiler for ~2,000 samples, JIT tiers included),
|
|
825
756
|
* never mixed into the timing numbers. Task/group `cpu` overrides this. */
|
|
826
757
|
cpu?: boolean;
|
|
827
|
-
/**
|
|
758
|
+
/**
|
|
759
|
+
* `cpu`'s sampling interval, µs (default: 100). A coarser interval
|
|
828
760
|
* lengthens the capture to keep the sample count, up to 10s per task. */
|
|
829
761
|
cpuIntervalUs?: number;
|
|
830
|
-
/**
|
|
762
|
+
/**
|
|
763
|
+
* Capture one extra `phase: "memstats"` measurement per task: retained
|
|
831
764
|
* heap growth per call, from a batch with `Bun.gc(true)` on both sides.
|
|
832
765
|
* What the calls keep alive, not what they allocate. Task/group `alloc`
|
|
833
766
|
* overrides this. */
|
|
834
767
|
alloc?: boolean;
|
|
835
|
-
/**
|
|
768
|
+
/**
|
|
769
|
+
* Capture one extra `phase: "memstats"` measurement per task: how far the
|
|
836
770
|
* task's first call raises RSS, garbage included. Median of 3 fresh
|
|
837
771
|
* processes, each run with `OSTIA_PEAK_MEM=1` in its environment (see
|
|
838
772
|
* `measurePeakMem`). Task/group `peakMem` overrides this. */
|
|
839
773
|
peakMem?: boolean;
|
|
840
774
|
filter?: string;
|
|
841
|
-
/**
|
|
775
|
+
/**
|
|
776
|
+
* Suite files (or isolated tasks) to run at once, each in its own child
|
|
842
777
|
* process (default: 1). Concurrent CPU-bound processes contend for cores,
|
|
843
778
|
* caches and turbo headroom, so timings under `jobs > 1` are noisier and
|
|
844
779
|
* not like-for-like with a baseline measured at 1. */
|
|
845
780
|
jobs?: number;
|
|
846
781
|
outDir?: string;
|
|
847
782
|
cwd?: string;
|
|
848
|
-
/**
|
|
783
|
+
/**
|
|
784
|
+
* Give every task its own subprocess instead of sharing its suite file's,
|
|
849
785
|
* isolating JIT tier state, inline caches and heap shape between tasks.
|
|
850
786
|
* Task/group `isolate` overrides this. Multiplies spawn overhead by task
|
|
851
787
|
* count instead of file count. */
|
|
852
788
|
isolate?: boolean;
|
|
853
|
-
/**
|
|
789
|
+
/**
|
|
790
|
+
* Scripts run, in order, before each suite file loads, in the same
|
|
854
791
|
* subprocess: install globals (jsdom) or a `Bun.plugin()` loader ahead of
|
|
855
792
|
* the suite's top-level code. */
|
|
856
793
|
preload?: string[];
|
|
857
|
-
/**
|
|
794
|
+
/**
|
|
795
|
+
* Extra flags for the `bun` invocation that runs each suite file (e.g.
|
|
858
796
|
* `["--conditions", "browser"]`), placed before the runner script path. */
|
|
859
797
|
bunFlags?: string[];
|
|
860
|
-
/**
|
|
798
|
+
/**
|
|
799
|
+
* Per-suite `preload` / `bunFlags`: the first project whose `suites` globs
|
|
861
800
|
* match a suite file (by its path relative to `cwd`) replaces those two
|
|
862
801
|
* fields for that file, so suites that need no setup don't pay for the
|
|
863
802
|
* others'. A field a project leaves unset keeps the top-level value above;
|
|
864
803
|
* `[]` clears it. */
|
|
865
804
|
projects?: BenchProject[];
|
|
866
|
-
/**
|
|
805
|
+
/**
|
|
806
|
+
* Measure this machine's noise floor once, before any suite runs
|
|
867
807
|
* (default: true), and stamp it on the document as `environment`. */
|
|
868
808
|
noiseCheck?: boolean;
|
|
869
|
-
/**
|
|
870
|
-
*
|
|
809
|
+
/**
|
|
810
|
+
* SIGKILLs a suite file's subprocess (or, under `isolate`, one task's)
|
|
811
|
+
* that hasn't finished after this many ms. No default. */
|
|
871
812
|
timeoutMs?: number;
|
|
872
|
-
/**
|
|
813
|
+
/**
|
|
814
|
+
* Aborting kills in-flight subprocesses, starts no new ones, and resolves
|
|
873
815
|
* (never rejects) with whatever suites/tasks had finished, plus an
|
|
874
816
|
* `aborted` warning on the last measurement. A suite killed mid-run is
|
|
875
817
|
* dropped entirely: it only writes its result once, at the end. */
|
|
876
818
|
signal?: AbortSignal;
|
|
877
819
|
}
|
|
878
|
-
|
|
879
820
|
export declare function bench(opts: BenchOptions): Promise<ProfileDocument>;
|
|
880
|
-
|
|
821
|
+
/**
|
|
822
|
+
* Geometric sweep points from `start` to `end`, growing by `multiplier`
|
|
823
|
+
* each step and always ending on `end` even if the last step overshot it.
|
|
824
|
+
* Mirrors mitata's `.range(name, start, end, multiplier)` point generation
|
|
825
|
+
* exactly, minus the name templating - build the task name yourself in the
|
|
826
|
+
* loop:
|
|
827
|
+
*
|
|
828
|
+
* for (const size of range(100, 10_000)) {
|
|
829
|
+
* const input = buildInput(size)
|
|
830
|
+
* task(`${size} items`, () => parse(input))
|
|
831
|
+
* }
|
|
832
|
+
*
|
|
833
|
+
* range(100, 10_000) -> [100, 800, 6400, 10000]
|
|
834
|
+
* range(100, 100_000) -> [100, 800, 6400, 51200, 100000]
|
|
835
|
+
*/
|
|
881
836
|
export declare function range(start: number, end: number, multiplier?: number): number[];
|
|
882
|
-
|
|
837
|
+
export interface GroupOptions {
|
|
838
|
+
/**
|
|
839
|
+
* What this group measures and why. Flows into `Workload.groupDescription`
|
|
840
|
+
* on every task in the group. */
|
|
841
|
+
description?: string;
|
|
842
|
+
/**
|
|
843
|
+
* Default `isolate` for every task in this group, unless a task overrides
|
|
844
|
+
* it with its own `TaskOptions.isolate`. */
|
|
845
|
+
isolate?: boolean;
|
|
846
|
+
/**
|
|
847
|
+
* Default `gc` for every task in this group, unless a task overrides it
|
|
848
|
+
* with its own `TaskOptions.gc`. */
|
|
849
|
+
gc?: boolean;
|
|
850
|
+
/**
|
|
851
|
+
* Default `cpu` for every task in this group, unless a task overrides it
|
|
852
|
+
* with its own `TaskOptions.cpu`. */
|
|
853
|
+
cpu?: boolean;
|
|
854
|
+
/**
|
|
855
|
+
* Default `alloc` for every task in this group, unless a task overrides
|
|
856
|
+
* it with its own `TaskOptions.alloc`. */
|
|
857
|
+
alloc?: boolean;
|
|
858
|
+
/**
|
|
859
|
+
* Default `peakMem` for every task in this group, unless a task
|
|
860
|
+
* overrides it with its own `TaskOptions.peakMem`. */
|
|
861
|
+
peakMem?: boolean;
|
|
862
|
+
/**
|
|
863
|
+
* Runs once, unmeasured, before the group's first task's warmup (not
|
|
864
|
+
* before every task) - in whichever process runs that task, so it works
|
|
865
|
+
* with `isolate`. */
|
|
866
|
+
before?: Hook;
|
|
867
|
+
/** Runs once, unmeasured, after the group's last task's last trial. */
|
|
868
|
+
after?: Hook;
|
|
869
|
+
}
|
|
883
870
|
type Hook = () => unknown | Promise<unknown>;
|
|
884
|
-
|
|
885
871
|
export interface TaskOptions {
|
|
886
|
-
/**
|
|
872
|
+
/**
|
|
873
|
+
* Marks this task as the Relative reference for its group in the table
|
|
887
874
|
* renderer, mirroring mitata's `baseline()`. At most one per group. */
|
|
888
875
|
baseline?: boolean;
|
|
889
876
|
/** Per-task time budget; overrides the suite-wide `--budget` / `budgetMs`. */
|
|
890
877
|
budgetMs?: number;
|
|
891
|
-
/**
|
|
878
|
+
/**
|
|
879
|
+
* Per-task exact trial count; overrides the suite-wide `--samples` /
|
|
892
880
|
* `samples`. When set, the budget is ignored for this task. */
|
|
893
881
|
samples?: number;
|
|
894
|
-
/**
|
|
895
|
-
* `
|
|
882
|
+
/**
|
|
883
|
+
* Per-task hard floor on trials; overrides the suite-wide `--min-samples`
|
|
884
|
+
* / `minSamples`. */
|
|
896
885
|
minSamples?: number;
|
|
897
|
-
/**
|
|
886
|
+
/**
|
|
887
|
+
* Former names of this task in the same group, so `compare` and `ab`
|
|
898
888
|
* match a base measured before a rename instead of reporting the old name
|
|
899
889
|
* as removed and the new one as new. */
|
|
900
890
|
aliases?: string[];
|
|
901
|
-
/**
|
|
902
|
-
*
|
|
891
|
+
/**
|
|
892
|
+
* What this task measures and why. Flows into `Workload.description` so
|
|
893
|
+
* the intent travels with the numbers instead of living only in a source
|
|
894
|
+
* comment. */
|
|
903
895
|
description?: string;
|
|
904
|
-
/**
|
|
896
|
+
/**
|
|
897
|
+
* Give this task its own subprocess instead of sharing its suite file's,
|
|
905
898
|
* isolating its JIT tier state and heap shape from every other task in the
|
|
906
899
|
* run. Overrides the group's and the suite-wide `bench({ isolate })` /
|
|
907
900
|
* `--isolate` default for this task only. */
|
|
908
901
|
isolate?: boolean;
|
|
909
|
-
/**
|
|
902
|
+
/**
|
|
903
|
+
* Overrides the suite-wide `bench({ gc })` / `--gc` (and any
|
|
910
904
|
* `GroupOptions.gc`) for this task only. */
|
|
911
905
|
gc?: boolean;
|
|
912
|
-
/**
|
|
906
|
+
/**
|
|
907
|
+
* Overrides the suite-wide `bench({ cpu })` / `--cpu` (and any
|
|
913
908
|
* `GroupOptions.cpu`) for this task only: after the timing measurement,
|
|
914
909
|
* capture one extra `phase: "cpu"` measurement (JIT tiers included) on
|
|
915
910
|
* the same workload, never mixed into the timing numbers. */
|
|
916
911
|
cpu?: boolean;
|
|
917
|
-
/**
|
|
912
|
+
/**
|
|
913
|
+
* Overrides the suite-wide `bench({ alloc })` / `--alloc` (and any
|
|
918
914
|
* `GroupOptions.alloc`) for this task only: after the timing measurement,
|
|
919
915
|
* capture one extra `phase: "memstats"` measurement of the heap each call
|
|
920
916
|
* retains (what survives a full GC, not what it allocates). */
|
|
921
917
|
alloc?: boolean;
|
|
922
|
-
/**
|
|
918
|
+
/**
|
|
919
|
+
* Overrides the suite-wide `bench({ peakMem })` / `--peak-mem` (and any
|
|
923
920
|
* `GroupOptions.peakMem`) for this task only: capture one extra
|
|
924
921
|
* `phase: "memstats"` measurement of how far one call raises the
|
|
925
922
|
* process's peak RSS, in fresh processes. */
|
|
926
923
|
peakMem?: boolean;
|
|
927
|
-
/**
|
|
924
|
+
/**
|
|
925
|
+
* Structured parameters this task represents (e.g. `{ size: 800, impl:
|
|
928
926
|
* "fast" }`), written to `Workload.params` and folded into the workload id
|
|
929
927
|
* so points with the same task name don't collide. Inside `sweep()`, the
|
|
930
928
|
* current point is inherited automatically; an explicit `params` here
|
|
931
929
|
* merges over it (explicit keys win). */
|
|
932
930
|
params?: Record<string, string | number | boolean>;
|
|
933
|
-
/**
|
|
931
|
+
/**
|
|
932
|
+
* Runs once, unmeasured, immediately before this task's warmup - in the
|
|
934
933
|
* task's own process, so it works with `isolate`. No per-trial hook: that
|
|
935
934
|
* would defeat batching. Use `gc` (Bun.gc between trials) or `isolate`
|
|
936
935
|
* (a fresh process per task) for per-trial concerns instead. */
|
|
937
936
|
before?: Hook;
|
|
938
|
-
/**
|
|
937
|
+
/**
|
|
938
|
+
* Runs once, unmeasured, immediately after this task's last trial. Same
|
|
939
939
|
* process/no-per-trial caveats as `before`. */
|
|
940
940
|
after?: Hook;
|
|
941
941
|
}
|
|
942
|
-
|
|
943
|
-
export interface GroupOptions {
|
|
944
|
-
/** What this group measures and why. Flows into `Workload.groupDescription`
|
|
945
|
-
* on every task in the group. */
|
|
946
|
-
description?: string;
|
|
947
|
-
/** Default `isolate` for every task in this group, unless a task overrides
|
|
948
|
-
* it with its own `TaskOptions.isolate`. */
|
|
949
|
-
isolate?: boolean;
|
|
950
|
-
/** Default `gc` for every task in this group, unless a task overrides it
|
|
951
|
-
* with its own `TaskOptions.gc`. */
|
|
952
|
-
gc?: boolean;
|
|
953
|
-
/** Default `cpu` for every task in this group, unless a task overrides it
|
|
954
|
-
* with its own `TaskOptions.cpu`. */
|
|
955
|
-
cpu?: boolean;
|
|
956
|
-
/** Default `alloc` for every task in this group, unless a task overrides
|
|
957
|
-
* it with its own `TaskOptions.alloc`. */
|
|
958
|
-
alloc?: boolean;
|
|
959
|
-
/** Default `peakMem` for every task in this group, unless a task
|
|
960
|
-
* overrides it with its own `TaskOptions.peakMem`. */
|
|
961
|
-
peakMem?: boolean;
|
|
962
|
-
/** Runs once, unmeasured, before the group's first task's warmup (not
|
|
963
|
-
* before every task) - in whichever process runs that task, so it works
|
|
964
|
-
* with `isolate`. */
|
|
965
|
-
before?: Hook;
|
|
966
|
-
/** Runs once, unmeasured, after the group's last task's last trial. */
|
|
967
|
-
after?: Hook;
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
type GroupRegistrar = (name: string, fn: () => void, opts?: GroupOptions) => void;
|
|
971
|
-
|
|
942
|
+
export declare const group: GroupFn;
|
|
972
943
|
interface GroupFn extends GroupRegistrar {
|
|
973
|
-
/**
|
|
944
|
+
/**
|
|
945
|
+
* Registers every task inside as skipped: the runner never measures
|
|
974
946
|
* them, but the document still carries their workloads (marked
|
|
975
947
|
* `Workload.skipped`). */
|
|
976
948
|
skip: GroupRegistrar;
|
|
977
|
-
/**
|
|
949
|
+
/**
|
|
950
|
+
* When any task or group in the suite uses `.only`, the runner restricts
|
|
978
951
|
* the whole suite file to only those tasks (before `--filter` narrows
|
|
979
952
|
* further) and prints a one-line notice to stderr. */
|
|
980
953
|
only: GroupRegistrar;
|
|
981
954
|
}
|
|
982
|
-
|
|
983
|
-
export declare const
|
|
984
|
-
|
|
985
|
-
type TaskRegistrar = (name: string, fn: () => unknown | Promise<unknown>, opts?: TaskOptions) => void;
|
|
986
|
-
|
|
955
|
+
type GroupRegistrar = (name: string, fn: () => void, opts?: GroupOptions) => void;
|
|
956
|
+
export declare const task: TaskFn;
|
|
987
957
|
interface TaskFn extends TaskRegistrar {
|
|
988
|
-
/**
|
|
958
|
+
/**
|
|
959
|
+
* Registers the task as skipped: the runner never measures it, but the
|
|
989
960
|
* document still carries its workload (marked `Workload.skipped`) so a
|
|
990
961
|
* renderer or `compare` can say so explicitly instead of the task simply
|
|
991
962
|
* being absent. */
|
|
992
963
|
skip: TaskRegistrar;
|
|
993
|
-
/**
|
|
964
|
+
/**
|
|
965
|
+
* When any task or group in the suite uses `.only`, the runner restricts
|
|
994
966
|
* the whole suite file to only those tasks (before `--filter` narrows
|
|
995
967
|
* further) and prints a one-line notice to stderr. */
|
|
996
968
|
only: TaskRegistrar;
|
|
997
969
|
}
|
|
998
|
-
|
|
999
|
-
export declare const task: TaskFn;
|
|
1000
|
-
|
|
970
|
+
type TaskRegistrar = (name: string, fn: () => unknown | Promise<unknown>, opts?: TaskOptions) => void;
|
|
1001
971
|
export interface RunOptions extends MeasureTasksOpts {
|
|
1002
972
|
/** Regex matched against "group/name" task ids, as in `bench({ filter })`. */
|
|
1003
973
|
filter?: string;
|
|
@@ -1006,45 +976,24 @@ export interface RunOptions extends MeasureTasksOpts {
|
|
|
1006
976
|
/** Renderer used for the printed report (default: `"table"`). */
|
|
1007
977
|
format?: FormatName;
|
|
1008
978
|
}
|
|
1009
|
-
|
|
1010
|
-
export declare function run(opts?: RunOptions): Promise<ProfileDocument>;
|
|
1011
|
-
|
|
1012
|
-
type FormatName = "table" | "json" | "markdown" | "jsonl" | "minimal" | "collapsed" | "mermaid" | "speedscope" | "cpuprofile";
|
|
1013
|
-
|
|
1014
|
-
export interface VizOptions {
|
|
1015
|
-
/** Render this measurement only, instead of every CPU measurement. */
|
|
1016
|
-
measurementId?: string;
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
interface RenderResult {
|
|
1020
|
-
text?: string;
|
|
1021
|
-
files?: {
|
|
1022
|
-
path?: string;
|
|
1023
|
-
content: string;
|
|
1024
|
-
}[];
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
interface Renderer<O = unknown> {
|
|
1028
|
-
name: FormatName;
|
|
1029
|
-
render(doc: ProfileDocument, options: O): Promise<RenderResult>;
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
979
|
interface MeasureTasksOpts extends InprocessTimingOptions {
|
|
1033
|
-
/**
|
|
980
|
+
/**
|
|
981
|
+
* Suite-wide default for capturing an extra `phase: "cpu"` measurement per
|
|
1034
982
|
* task (task/group `cpu` still wins). */
|
|
1035
983
|
cpu?: boolean;
|
|
1036
984
|
/** `cpu`'s sampling interval, µs (default: 100). */
|
|
1037
985
|
cpuIntervalUs?: number;
|
|
1038
|
-
/**
|
|
986
|
+
/**
|
|
987
|
+
* Suite-wide default for capturing an extra `phase: "memstats"`
|
|
1039
988
|
* measurement per task (task/group `alloc` still wins). */
|
|
1040
989
|
alloc?: boolean;
|
|
1041
990
|
/** Stamped onto every workload: it ran in a subprocess dedicated to it. */
|
|
1042
991
|
markIsolated?: boolean;
|
|
1043
|
-
/**
|
|
992
|
+
/**
|
|
993
|
+
* Measure this machine's noise floor before the first task (default:
|
|
1044
994
|
* true) and stamp it on the document as `environment`. */
|
|
1045
995
|
noiseCheck?: boolean;
|
|
1046
996
|
}
|
|
1047
|
-
|
|
1048
997
|
interface InprocessTimingOptions {
|
|
1049
998
|
/** Wall-clock budget for the sampling loop, per task (default: 500). */
|
|
1050
999
|
budgetMs?: number;
|
|
@@ -1054,23 +1003,227 @@ interface InprocessTimingOptions {
|
|
|
1054
1003
|
* the floor is cost-aware (see `defaultSampleFloor`). */
|
|
1055
1004
|
minSamples?: number;
|
|
1056
1005
|
/** Warmup budget as a fraction of `budgetMs` (default: 0.1); unlike
|
|
1057
|
-
* `time()`'s `warmup`, which is a trial count. Always runs at least one
|
|
1006
|
+
* `time()`'s `warmup`, which is a trial count. Always runs at least one
|
|
1007
|
+
* call. */
|
|
1058
1008
|
warmup?: number;
|
|
1059
1009
|
gc?: boolean;
|
|
1060
1010
|
}
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1011
|
+
type FormatName = "table" | "json" | "markdown" | "jsonl" | "minimal" | "collapsed" | "mermaid" | "speedscope" | "cpuprofile";
|
|
1012
|
+
/** In-file entrypoint: call at the bottom of a suite file run directly with
|
|
1013
|
+
* `bun suite.ts` to measure every registered `group()`/`task()`, print a
|
|
1014
|
+
* report, and return the document.
|
|
1015
|
+
*
|
|
1016
|
+
* Everything runs in the current process, so `TaskOptions.isolate` is
|
|
1017
|
+
* ignored. Prefer `ostia bench`/`bench()` for numbers you'll
|
|
1018
|
+
* `compare`/`ci` against. */
|
|
1019
|
+
export declare function run(opts?: RunOptions): Promise<ProfileDocument>;
|
|
1020
|
+
/** Cartesian product over `dims`, calling `fn` once per point. Inside `fn`,
|
|
1021
|
+
* `task()` calls automatically inherit the point as their params (an
|
|
1022
|
+
* explicit `TaskOptions.params` merges over it, explicit keys win):
|
|
1023
|
+
*
|
|
1024
|
+
* group("parse", () => {
|
|
1025
|
+
* sweep({ size: range(100, 10_000), impl: ["current", "fast"] }, ({ size, impl }) => {
|
|
1026
|
+
* const input = build(size)
|
|
1027
|
+
* task(`${impl}`, () => impls[impl](input))
|
|
1028
|
+
* })
|
|
1029
|
+
* })
|
|
1030
|
+
*/
|
|
1031
|
+
export declare function sweep<T extends Record<string, readonly unknown[]>>(dims: T, fn: (point: SweepPoint<T>) => void): void;
|
|
1064
1032
|
type SweepPoint<T extends Record<string, readonly unknown[]>> = {
|
|
1065
1033
|
[K in keyof T]: T[K][number];
|
|
1066
1034
|
};
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1035
|
+
export interface CompareResult {
|
|
1036
|
+
comparisons: Comparison[];
|
|
1037
|
+
unmatched: {
|
|
1038
|
+
baseOnly: Workload[];
|
|
1039
|
+
candOnly: Workload[];
|
|
1040
|
+
};
|
|
1041
|
+
/** Every task on either side; see `ProfileDocument.compared`. */
|
|
1042
|
+
compared: ComparedTask[];
|
|
1043
|
+
summary: ComparisonSummary;
|
|
1044
|
+
}
|
|
1045
|
+
export interface Thresholds {
|
|
1046
|
+
timingPct: number;
|
|
1047
|
+
frameSelfPct: number;
|
|
1048
|
+
heapTypePct: number;
|
|
1049
|
+
minFrameSelfUs: number;
|
|
1050
|
+
/**
|
|
1051
|
+
* A `regressed` / `improved` verdict also requires Mann-Whitney `pValue <
|
|
1052
|
+
* alpha`.
|
|
1053
|
+
*/
|
|
1054
|
+
alpha: number;
|
|
1055
|
+
/** Bootstrap resample rounds for the timing CI. */
|
|
1056
|
+
bootstrapIterations: number;
|
|
1057
|
+
}
|
|
1058
|
+
/**
|
|
1059
|
+
* Compares every `cand.workloads` entry that has a match in `base` (in
|
|
1060
|
+
* candidate order, as `ostia ci` does), and reports what matched only one
|
|
1061
|
+
* side in `unmatched` rather than dropping it. */
|
|
1062
|
+
export declare function compareDocuments(base: ProfileDocument, cand: ProfileDocument, thresholds?: Thresholds): CompareResult;
|
|
1063
|
+
export declare const DEFAULT_THRESHOLDS: Thresholds;
|
|
1064
|
+
/**
|
|
1065
|
+
* Settings for `ostia ab` only; it reads the rest (suites, filter,
|
|
1066
|
+
* preload, ...) from `bench`. */
|
|
1067
|
+
export interface AbConfig {
|
|
1068
|
+
/**
|
|
1069
|
+
* Shell command(s) run once in a freshly extracted base tree, e.g. to
|
|
1070
|
+
* build gitignored files the suites import; see `AbOptions.baseSetup`.
|
|
1071
|
+
* `--base-setup` replaces this list. */
|
|
1072
|
+
setup?: string | string[];
|
|
1073
|
+
/**
|
|
1074
|
+
* Base trees to keep cached; see `AbOptions.keepTrees`. `--keep-trees`
|
|
1075
|
+
* overrides. Default: 5. */
|
|
1076
|
+
keepTrees?: number;
|
|
1077
|
+
/**
|
|
1078
|
+
* Judge rounds by `"time"` or `"instructions"`; see `AbOptions.metric`.
|
|
1079
|
+
* `--metric` overrides. Default: `"time"`. */
|
|
1080
|
+
metric?: "time" | "instructions";
|
|
1081
|
+
/**
|
|
1082
|
+
* Compare retained heap per call; see `AbOptions.alloc`. `--alloc` /
|
|
1083
|
+
* `--no-alloc` override. `bench.alloc` doesn't apply to `ab`. */
|
|
1084
|
+
alloc?: boolean;
|
|
1085
|
+
/**
|
|
1086
|
+
* Compare peak RSS of the first call; see `AbOptions.peakMem`.
|
|
1087
|
+
* `--peak-mem` / `--no-peak-mem` override. `bench.peakMem` doesn't apply
|
|
1088
|
+
* to `ab`. */
|
|
1089
|
+
peakMem?: boolean;
|
|
1090
|
+
/**
|
|
1091
|
+
* Memory verdict threshold, percent; see `AbOptions.memThresholdPct`.
|
|
1092
|
+
* `--mem-threshold` overrides. Default: 10. */
|
|
1093
|
+
memThresholdPct?: number;
|
|
1094
|
+
}
|
|
1095
|
+
export interface OstiaConfig {
|
|
1096
|
+
/** `command` workloads: exact trial count; see `time()`. */
|
|
1097
|
+
samples?: number;
|
|
1098
|
+
/** `command` workloads: sampling budget in ms; see `time()`. */
|
|
1099
|
+
budgetMs?: number;
|
|
1100
|
+
/** `command` workloads: floor on trials; see `time()`. */
|
|
1101
|
+
minSamples?: number;
|
|
1102
|
+
warmup: number;
|
|
1103
|
+
outDir: string;
|
|
1104
|
+
baselineDir: string;
|
|
1105
|
+
baseline: string;
|
|
1106
|
+
thresholds: Thresholds;
|
|
1107
|
+
workloads: WorkloadConfig[];
|
|
1108
|
+
bench?: BenchConfig;
|
|
1109
|
+
ab?: AbConfig;
|
|
1110
|
+
/**
|
|
1111
|
+
* `ostia ci`'s policy for a workload with no matching baseline row (by
|
|
1112
|
+
* workload id): `"fail"` exits 2 naming the baseline file, `"warn"` lists
|
|
1113
|
+
* it in the report. Unset: `"fail"` when every workload is missing (a
|
|
1114
|
+
* stale or wrong baseline), `"warn"` otherwise. */
|
|
1115
|
+
onMissingBaseline?: "warn" | "fail";
|
|
1116
|
+
/**
|
|
1117
|
+
* Measure the machine's noise floor once per `ostia ci` run (default
|
|
1118
|
+
* true) and stamp it on the candidate document, so `compare` widens its
|
|
1119
|
+
* thresholds accordingly. `--no-noise-check` overrides this per run. */
|
|
1120
|
+
noiseCheck?: boolean;
|
|
1121
|
+
}
|
|
1122
|
+
/**
|
|
1123
|
+
* Exactly one of `command` (a subprocess to time) / `suites` (in-process
|
|
1124
|
+
* `group()`/`task()` suite file globs, run via `bench()`, each task gated
|
|
1125
|
+
* individually) must be given. */
|
|
1126
|
+
export interface WorkloadConfig {
|
|
1127
|
+
label?: string;
|
|
1128
|
+
command?: string[];
|
|
1129
|
+
suites?: string[];
|
|
1130
|
+
/**
|
|
1131
|
+
* `command` only. Globs of the files the timing depends on: `ostia ci`
|
|
1132
|
+
* reuses a cached run while their contents are unchanged. Omitted, the
|
|
1133
|
+
* workload always reruns; `[]` caches until the command or config changes.
|
|
1134
|
+
* */
|
|
1135
|
+
inputs?: string[];
|
|
1136
|
+
/**
|
|
1137
|
+
* `command` only. Runs before every trial (warmup included), unmeasured:
|
|
1138
|
+
* a command string / argv array, or in `ostia.config.ts` a function. A
|
|
1139
|
+
* function makes the workload uncacheable for `ostia ci`. */
|
|
1140
|
+
prepare?: PrepareHook;
|
|
1141
|
+
/**
|
|
1142
|
+
* `command` only. Take timing from a number in the command's own output
|
|
1143
|
+
* instead of its wall clock; see `TimeSource`. */
|
|
1144
|
+
timeSource?: TimeSource;
|
|
1145
|
+
/**
|
|
1146
|
+
* `command`: kills a trial (or prepare hook) after this many ms.
|
|
1147
|
+
* `suites`: kills a suite file's (or isolated task's) process after this
|
|
1148
|
+
* many ms, overriding `bench.timeoutMs`. Overrides `ostia ci`'s 10-minute
|
|
1149
|
+
* default. */
|
|
1150
|
+
timeoutMs?: number;
|
|
1151
|
+
/**
|
|
1152
|
+
* `command` only. Exit codes to treat as success; see
|
|
1153
|
+
* `TimeOptions.ignoreExitCodes`. */
|
|
1154
|
+
ignoreExitCodes?: number[];
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Runs unmeasured before every trial of a command, in its `cwd`/`env`
|
|
1158
|
+
* (hyperfine's `--prepare`): a shell-less command (string,
|
|
1159
|
+
* whitespace-split, or argv array) that must exit 0 or the run aborts, or
|
|
1160
|
+
* a function. */
|
|
1161
|
+
export type PrepareHook = string | string[] | PrepareFn;
|
|
1162
|
+
/** Return value ignored; a returned promise is awaited. */
|
|
1163
|
+
export type PrepareFn = (run: PrepareRun) => unknown;
|
|
1164
|
+
/**
|
|
1165
|
+
* `index` counts from 0 within each phase, so "first run" logic checks
|
|
1166
|
+
* `phase === "warmup" && index === 0` (or `phase === "timing"` when warmup
|
|
1167
|
+
* is 0). */
|
|
1168
|
+
export interface PrepareRun {
|
|
1169
|
+
phase: "warmup" | "timing" | "cpu" | "heap";
|
|
1170
|
+
index: number;
|
|
1171
|
+
}
|
|
1172
|
+
/**
|
|
1173
|
+
* Take a command's timing from a number in its own stdout/stderr instead
|
|
1174
|
+
* of the wall clock (e.g. a build tool's `built in 342ms` line). `pattern`
|
|
1175
|
+
* is matched against stdout, then stderr; `group` (default 1) holds the
|
|
1176
|
+
* number; `unit` defaults to "ms". A trial that doesn't match contributes
|
|
1177
|
+
* no sample (`time-source-no-match` warning); if every trial misses, the
|
|
1178
|
+
* workload has no timing stats. A `RegExp` pattern must not carry the `g`,
|
|
1179
|
+
* `y`, or `d` flag: it is reused across trials, and `lastIndex` would make
|
|
1180
|
+
* it alternate match/no-match. */
|
|
1181
|
+
export interface TimeSource {
|
|
1182
|
+
pattern: string | RegExp;
|
|
1183
|
+
group?: number;
|
|
1184
|
+
unit?: TimeUnit;
|
|
1185
|
+
}
|
|
1186
|
+
export type TimeUnit = "ns" | "us" | "ms" | "s";
|
|
1187
|
+
interface BenchConfig {
|
|
1188
|
+
/**
|
|
1189
|
+
* Suite file globs, resolved against the config's directory (e.g.
|
|
1190
|
+
* "bench/**\/*.bench.ts"). Suite files given on the command line replace
|
|
1191
|
+
* this list. */
|
|
1192
|
+
suites?: string[];
|
|
1193
|
+
/**
|
|
1194
|
+
* Per-suite `preload`/`bunFlags`, so one tier (e.g. DOM-dependent suites)
|
|
1195
|
+
* can pay for a setup the others don't need. The first project whose
|
|
1196
|
+
* `suites` match a file wins; a file no project matches gets the top-level
|
|
1197
|
+
* `preload`/`bunFlags`. `--preload` / `--bun-flags` replace the matching
|
|
1198
|
+
* field for every file. */
|
|
1199
|
+
projects?: BenchProject[];
|
|
1200
|
+
preload?: string[];
|
|
1201
|
+
/**
|
|
1202
|
+
* Extra flags for the `bun` process that runs each suite file; see
|
|
1203
|
+
* `BenchOptions.bunFlags`. `--bun-flags` replaces this list. */
|
|
1204
|
+
bunFlags?: string[];
|
|
1205
|
+
jobs?: number | "auto";
|
|
1206
|
+
budgetMs?: number;
|
|
1207
|
+
samples?: number;
|
|
1208
|
+
minSamples?: number;
|
|
1209
|
+
gc?: boolean;
|
|
1210
|
+
cpu?: boolean;
|
|
1211
|
+
cpuIntervalUs?: number;
|
|
1212
|
+
alloc?: boolean;
|
|
1213
|
+
peakMem?: boolean;
|
|
1214
|
+
filter?: string;
|
|
1215
|
+
isolate?: boolean;
|
|
1216
|
+
outDir?: string;
|
|
1217
|
+
/**
|
|
1218
|
+
* Kills a suite file's (or isolated task's) subprocess after this many
|
|
1219
|
+
* ms; overrides `ostia ci`'s 10-minute default. */
|
|
1220
|
+
timeoutMs?: number;
|
|
1221
|
+
}
|
|
1222
|
+
export type OstiaConfigInput = Omit<Partial<OstiaConfig>, "thresholds"> & {
|
|
1223
|
+
thresholds?: Partial<Thresholds>;
|
|
1224
|
+
};
|
|
1070
1225
|
export declare function createDocument(workloads: Workload[], measurements: Measurement[], environment?: Environment): ProfileDocument;
|
|
1071
|
-
|
|
1072
|
-
export declare function saveDocument(doc: ProfileDocument, path: string): Promise<void>;
|
|
1073
|
-
|
|
1226
|
+
export declare function loadDocument(path: string): Promise<ProfileDocument>;
|
|
1074
1227
|
export declare class OstiaDocumentError extends Error {
|
|
1075
1228
|
readonly code: "invalid-json" | "not-a-document" | "unsupported-schema";
|
|
1076
1229
|
readonly path?: string;
|
|
@@ -1080,35 +1233,43 @@ export declare class OstiaDocumentError extends Error {
|
|
|
1080
1233
|
schemaVersion?: unknown;
|
|
1081
1234
|
});
|
|
1082
1235
|
}
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1236
|
+
export declare function saveDocument(doc: ProfileDocument, path: string): Promise<void>;
|
|
1237
|
+
/** Pins `value` against dead-code elimination for an intermediate inside a
|
|
1238
|
+
* task body. A task's own return value is already pinned by the timing
|
|
1239
|
+
* loop. */
|
|
1240
|
+
export declare function keep(value: unknown): void;
|
|
1086
1241
|
export interface ProfileOptions {
|
|
1087
|
-
/**
|
|
1242
|
+
/**
|
|
1243
|
+
* Sampling interval in µs; default 1000. Named like `time()`'s and
|
|
1088
1244
|
* `bench()`'s option, the config key and `--cpu-interval`. */
|
|
1089
1245
|
cpuIntervalUs?: number;
|
|
1090
|
-
/**
|
|
1246
|
+
/**
|
|
1247
|
+
* Names the workload: it becomes the label and, instead of the function's
|
|
1091
1248
|
* name and source, what the id hashes, so closures that differ only in
|
|
1092
|
-
* captured values get distinct ids and the id survives editing the
|
|
1249
|
+
* captured values get distinct ids and the id survives editing the
|
|
1250
|
+
* function. */
|
|
1093
1251
|
name?: string;
|
|
1094
|
-
/**
|
|
1095
|
-
*
|
|
1096
|
-
*
|
|
1252
|
+
/**
|
|
1253
|
+
* `"inspector"` (default) captures through CDP and writes a portable
|
|
1254
|
+
* .cpuprofile; `"jsc"` uses `bun:jsc.profile` and adds
|
|
1255
|
+
* LLInt/Baseline/DFG/FTL tier data. */
|
|
1097
1256
|
origin?: "inspector" | "jsc";
|
|
1098
|
-
/**
|
|
1099
|
-
*
|
|
1100
|
-
*
|
|
1257
|
+
/**
|
|
1258
|
+
* There's no child to kill, so an already-aborted signal skips the
|
|
1259
|
+
* profiler, calls `fn` plain (still returning its `result`) and records an
|
|
1260
|
+
* `aborted` warning instead of CPU evidence. It can't interrupt a running
|
|
1261
|
+
* `fn`. */
|
|
1101
1262
|
signal?: AbortSignal;
|
|
1102
1263
|
}
|
|
1103
|
-
|
|
1104
1264
|
export interface ProfileResult<T> {
|
|
1105
1265
|
result: T;
|
|
1106
1266
|
measurement: Measurement;
|
|
1107
1267
|
document: ProfileDocument;
|
|
1108
1268
|
}
|
|
1109
|
-
|
|
1110
1269
|
export declare function profile<T>(fn: () => T | Promise<T>, opts?: ProfileOptions): Promise<ProfileResult<T>>;
|
|
1111
|
-
|
|
1270
|
+
/** Each format's renderer, typed with its own options. `Renderer<never>` is
|
|
1271
|
+
* the top type, so `satisfies` checks every format is present without
|
|
1272
|
+
* widening the options. */
|
|
1112
1273
|
export declare const renderers: {
|
|
1113
1274
|
table: Renderer<unknown>;
|
|
1114
1275
|
json: Renderer<unknown>;
|
|
@@ -1120,75 +1281,61 @@ export declare const renderers: {
|
|
|
1120
1281
|
speedscope: Renderer<VizOptions>;
|
|
1121
1282
|
cpuprofile: Renderer<VizOptions>;
|
|
1122
1283
|
};
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
interface MinimalWarning {
|
|
1127
|
-
code: string;
|
|
1128
|
-
data?: Record<string, unknown>;
|
|
1129
|
-
}
|
|
1130
|
-
|
|
1131
|
-
interface MinimalDelta {
|
|
1132
|
-
/** The base's median, ns: the row's own `median` is the candidate's. */
|
|
1133
|
-
baseMedian?: number;
|
|
1134
|
-
medianPct: number;
|
|
1135
|
-
meanPct: number;
|
|
1136
|
-
verdict: "improved" | "regressed" | "unchanged";
|
|
1137
|
-
pass: boolean;
|
|
1138
|
-
/** 95% bootstrap CI on the difference of medians; absent (with `pValue`)
|
|
1139
|
-
* on a thin (<5 samples/side) comparison. */
|
|
1140
|
-
ci95?: [number, number];
|
|
1141
|
-
pValue?: number;
|
|
1142
|
-
/** The threshold actually tested against, after machine noise widened it. */
|
|
1143
|
-
effectiveTimingPct: number;
|
|
1144
|
-
matched: true;
|
|
1145
|
-
/** The base task's name, when it was matched through an alias. */
|
|
1146
|
-
renamedFrom?: string;
|
|
1284
|
+
export interface MinimalRenderOptions {
|
|
1285
|
+
protocol?: MinimalProtocolContext;
|
|
1147
1286
|
}
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
flagged?: "regressed" | "improved";
|
|
1160
|
-
confirmed?: boolean;
|
|
1161
|
-
/** Median ratio of each fresh-process repeat, by the summary's `metric`. */
|
|
1162
|
-
repeats?: number[];
|
|
1163
|
-
/** Where the machine counts them: the base's median instructions per call
|
|
1164
|
-
* and the candidate/base instruction ratios. */
|
|
1165
|
-
instructions?: {
|
|
1166
|
-
baseMedian: number;
|
|
1167
|
-
medianRatio: number;
|
|
1168
|
-
ratioP25: number;
|
|
1169
|
-
ratioP75: number;
|
|
1287
|
+
/**
|
|
1288
|
+
* What the `unmatched`/`summary` events need beyond one `ProfileDocument`.
|
|
1289
|
+
* The CLI builds it for `compare`/`ci`/`ab`; without it `minimal` emits
|
|
1290
|
+
* only `run` lines. `exitCode` is inline because the CLI decides it after
|
|
1291
|
+
* rendering. */
|
|
1292
|
+
export interface MinimalProtocolContext {
|
|
1293
|
+
command: "compare" | "ci" | "ab";
|
|
1294
|
+
exitCode: number;
|
|
1295
|
+
unmatched?: {
|
|
1296
|
+
baseOnly: Workload[];
|
|
1297
|
+
candOnly: Workload[];
|
|
1170
1298
|
};
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1299
|
+
baseGit?: GitMetadata;
|
|
1300
|
+
candGit?: GitMetadata;
|
|
1301
|
+
baseline?: {
|
|
1302
|
+
name: string;
|
|
1303
|
+
path: string;
|
|
1304
|
+
};
|
|
1305
|
+
cached?: number;
|
|
1306
|
+
executed?: number;
|
|
1307
|
+
failed?: number;
|
|
1308
|
+
missingBaseline?: number;
|
|
1309
|
+
exportedTo?: string;
|
|
1178
1310
|
}
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
cand: number;
|
|
1183
|
-
verdict: "regressed" | "improved" | "unchanged";
|
|
1184
|
-
floor: number;
|
|
1311
|
+
export interface VizOptions {
|
|
1312
|
+
/** Render this measurement only, instead of every CPU measurement. */
|
|
1313
|
+
measurementId?: string;
|
|
1185
1314
|
}
|
|
1186
|
-
|
|
1315
|
+
export interface MermaidOptions extends VizOptions {
|
|
1316
|
+
topN?: number;
|
|
1317
|
+
}
|
|
1318
|
+
interface Renderer<O = unknown> {
|
|
1319
|
+
name: FormatName;
|
|
1320
|
+
render(doc: ProfileDocument, options: O): Promise<RenderResult>;
|
|
1321
|
+
}
|
|
1322
|
+
interface RenderResult {
|
|
1323
|
+
text?: string;
|
|
1324
|
+
files?: {
|
|
1325
|
+
path?: string;
|
|
1326
|
+
content: string;
|
|
1327
|
+
}[];
|
|
1328
|
+
}
|
|
1329
|
+
export type MinimalEvent = MinimalRunLine | MinimalUnmatchedLine | MinimalSummaryLine;
|
|
1330
|
+
/**
|
|
1331
|
+
* One per timing run, for piping into an agent's context in place of the
|
|
1332
|
+
* full `ProfileDocument`. Numbers stay in the IR's units (ns). */
|
|
1187
1333
|
interface MinimalRunLine {
|
|
1188
1334
|
event: "run";
|
|
1189
1335
|
protocolVersion: typeof MINIMAL_PROTOCOL_VERSION;
|
|
1190
1336
|
schemaVersion: ProfileDocument["schemaVersion"];
|
|
1191
|
-
/**
|
|
1337
|
+
/**
|
|
1338
|
+
* Join key to `Workload.id` / `Comparison.candidateMeasurementId`; unlike
|
|
1192
1339
|
* `task`, stable across invocations. */
|
|
1193
1340
|
workloadId: string;
|
|
1194
1341
|
task: string;
|
|
@@ -1196,10 +1343,14 @@ interface MinimalRunLine {
|
|
|
1196
1343
|
description?: string;
|
|
1197
1344
|
groupDescription?: string;
|
|
1198
1345
|
params?: Record<string, string | number | boolean>;
|
|
1199
|
-
/**
|
|
1346
|
+
/**
|
|
1347
|
+
* `task.skip()` / `group.skip()`: no measurement, so every stats field is
|
|
1348
|
+
* absent.
|
|
1349
|
+
*/
|
|
1200
1350
|
skipped?: true;
|
|
1201
1351
|
unit?: "ns";
|
|
1202
|
-
/**
|
|
1352
|
+
/**
|
|
1353
|
+
* 0, with every stats field absent, when no trial produced a sample (all
|
|
1203
1354
|
* timed out or missed the `timeSource` pattern); see `warnings`. */
|
|
1204
1355
|
samples?: number;
|
|
1205
1356
|
/** In-process trials batched into one timed block; 1 when never batched. */
|
|
@@ -1221,21 +1372,25 @@ interface MinimalRunLine {
|
|
|
1221
1372
|
retainedBytesPerOp?: number;
|
|
1222
1373
|
/** `--peak-mem`: how far the task's first call raised RSS, bytes. */
|
|
1223
1374
|
peakBytes?: number;
|
|
1224
|
-
/**
|
|
1375
|
+
/**
|
|
1376
|
+
* In-process tasks, where the machine counts them: median instructions
|
|
1225
1377
|
* retired per call (`ab`: the candidate's). */
|
|
1226
1378
|
instructions?: number;
|
|
1227
|
-
/**
|
|
1379
|
+
/**
|
|
1380
|
+
* Median over the group's reference median (its baseline task, else its
|
|
1228
1381
|
* fastest); only when the document has more than one timing run. */
|
|
1229
1382
|
relative?: number;
|
|
1230
1383
|
baseline?: true;
|
|
1231
|
-
/**
|
|
1384
|
+
/**
|
|
1385
|
+
* The machine's noise floor from `document.environment`; absent when the
|
|
1232
1386
|
* noise check was skipped. */
|
|
1233
1387
|
noiseFloorPct?: number;
|
|
1234
1388
|
warnings: MinimalWarning[];
|
|
1235
1389
|
/** The change against the baseline document (`compare` / `ci`). */
|
|
1236
1390
|
delta?: MinimalDelta;
|
|
1237
1391
|
paired?: MinimalPaired;
|
|
1238
|
-
/**
|
|
1392
|
+
/**
|
|
1393
|
+
* `ab` only, instead of stats and `paired`: the task threw on one side
|
|
1239
1394
|
* (`"base"`/`"cand"`) or both, so it isn't judged on time. `message` is
|
|
1240
1395
|
* the error's first lines; `repeat` (from 1) is set when it threw in a
|
|
1241
1396
|
* confirmation repeat. */
|
|
@@ -1245,7 +1400,75 @@ interface MinimalRunLine {
|
|
|
1245
1400
|
repeat?: number;
|
|
1246
1401
|
};
|
|
1247
1402
|
}
|
|
1248
|
-
|
|
1403
|
+
/**
|
|
1404
|
+
* Bumped only on a breaking change to the event shapes (a key renamed or
|
|
1405
|
+
* removed); new keys are additive. Every line carries it. */
|
|
1406
|
+
export declare const MINIMAL_PROTOCOL_VERSION: 2;
|
|
1407
|
+
interface MinimalWarning {
|
|
1408
|
+
code: string;
|
|
1409
|
+
data?: Record<string, unknown>;
|
|
1410
|
+
}
|
|
1411
|
+
interface MinimalDelta {
|
|
1412
|
+
/** The base's median, ns: the row's own `median` is the candidate's. */
|
|
1413
|
+
baseMedian?: number;
|
|
1414
|
+
medianPct: number;
|
|
1415
|
+
meanPct: number;
|
|
1416
|
+
verdict: "improved" | "regressed" | "unchanged";
|
|
1417
|
+
pass: boolean;
|
|
1418
|
+
/**
|
|
1419
|
+
* 95% bootstrap CI on the difference of medians; absent (with `pValue`)
|
|
1420
|
+
* on a thin (<5 samples/side) comparison. */
|
|
1421
|
+
ci95?: [number, number];
|
|
1422
|
+
pValue?: number;
|
|
1423
|
+
/** The threshold actually tested against, after machine noise widened it. */
|
|
1424
|
+
effectiveTimingPct: number;
|
|
1425
|
+
matched: true;
|
|
1426
|
+
/** The base task's name, when it was matched through an alias. */
|
|
1427
|
+
renamedFrom?: string;
|
|
1428
|
+
}
|
|
1429
|
+
/**
|
|
1430
|
+
* `ab` only: the base side and per-round candidate/base ratios behind a
|
|
1431
|
+
* `run` line whose stats are the candidate's. Ratios above 1 mean slower.
|
|
1432
|
+
* */
|
|
1433
|
+
interface MinimalPaired {
|
|
1434
|
+
/** Base side's median per-call time, ns. */
|
|
1435
|
+
baseMedian: number;
|
|
1436
|
+
medianRatio: number;
|
|
1437
|
+
ratioP25: number;
|
|
1438
|
+
ratioP75: number;
|
|
1439
|
+
rounds: number;
|
|
1440
|
+
/** `flagged` when fresh processes confirmed it, else `"unchanged"`. */
|
|
1441
|
+
verdict: "regressed" | "improved" | "unchanged";
|
|
1442
|
+
/** What the first process saw, before confirmation. */
|
|
1443
|
+
flagged?: "regressed" | "improved";
|
|
1444
|
+
confirmed?: boolean;
|
|
1445
|
+
/** Median ratio of each fresh-process repeat, by the summary's `metric`. */
|
|
1446
|
+
repeats?: number[];
|
|
1447
|
+
/**
|
|
1448
|
+
* Where the machine counts them: the base's median instructions per call
|
|
1449
|
+
* and the candidate/base instruction ratios. */
|
|
1450
|
+
instructions?: {
|
|
1451
|
+
baseMedian: number;
|
|
1452
|
+
medianRatio: number;
|
|
1453
|
+
ratioP25: number;
|
|
1454
|
+
ratioP75: number;
|
|
1455
|
+
};
|
|
1456
|
+
sameOutput: boolean;
|
|
1457
|
+
/** The suite file differs from the base's copy. */
|
|
1458
|
+
suiteChanged?: true;
|
|
1459
|
+
/** `--alloc`: retained heap per call on each side. */
|
|
1460
|
+
retained?: MinimalMemoryChange;
|
|
1461
|
+
/** `--peak-mem`: first-call RSS rise on each side. */
|
|
1462
|
+
peak?: MinimalMemoryChange;
|
|
1463
|
+
}
|
|
1464
|
+
/** `ab` only: one memory reading on both sides, bytes. */
|
|
1465
|
+
interface MinimalMemoryChange {
|
|
1466
|
+
base: number;
|
|
1467
|
+
cand: number;
|
|
1468
|
+
verdict: "regressed" | "improved" | "unchanged";
|
|
1469
|
+
floor: number;
|
|
1470
|
+
}
|
|
1471
|
+
/** A workload present on only one side of a `compare`/`ci` run. */
|
|
1249
1472
|
interface MinimalUnmatchedLine {
|
|
1250
1473
|
event: "unmatched";
|
|
1251
1474
|
protocolVersion: typeof MINIMAL_PROTOCOL_VERSION;
|
|
@@ -1253,7 +1476,9 @@ interface MinimalUnmatchedLine {
|
|
|
1253
1476
|
task: string;
|
|
1254
1477
|
side: "base" | "cand";
|
|
1255
1478
|
}
|
|
1256
|
-
|
|
1479
|
+
/**
|
|
1480
|
+
* The last line of a `compare`/`ci`/`ab` run; never emitted for a bare
|
|
1481
|
+
* `time`/`bench` document. */
|
|
1257
1482
|
interface MinimalSummaryLine {
|
|
1258
1483
|
event: "summary";
|
|
1259
1484
|
protocolVersion: typeof MINIMAL_PROTOCOL_VERSION;
|
|
@@ -1283,19 +1508,27 @@ interface MinimalSummaryLine {
|
|
|
1283
1508
|
ref: string;
|
|
1284
1509
|
sha: string;
|
|
1285
1510
|
};
|
|
1286
|
-
/**
|
|
1511
|
+
/**
|
|
1512
|
+
* `ab` only: what the verdicts and `geomeanPct` judge, each round's time
|
|
1287
1513
|
* or instruction ratio. */
|
|
1288
1514
|
metric?: "time" | "instructions";
|
|
1289
1515
|
/** `ab` only: the gate on `geomeanPct`. */
|
|
1290
1516
|
geomeanThresholdPct?: number;
|
|
1291
|
-
/**
|
|
1517
|
+
/**
|
|
1518
|
+
* `ab` only: flagged in the first process but not reproduced; counted in
|
|
1519
|
+
* `unchanged`.
|
|
1520
|
+
*/
|
|
1292
1521
|
unconfirmed?: number;
|
|
1293
|
-
/**
|
|
1522
|
+
/**
|
|
1523
|
+
* `ab` only: workloads whose first call returned different values on the
|
|
1524
|
+
* two sides.
|
|
1525
|
+
*/
|
|
1294
1526
|
outputDiffers?: number;
|
|
1295
1527
|
notComparable?: number;
|
|
1296
1528
|
threw?: number;
|
|
1297
1529
|
newSuites?: string[];
|
|
1298
|
-
/**
|
|
1530
|
+
/**
|
|
1531
|
+
* `ab` only, with `--alloc` or `--peak-mem`: tasks whose memory
|
|
1299
1532
|
* regressed or improved, and the threshold, percent. */
|
|
1300
1533
|
memory?: {
|
|
1301
1534
|
thresholdPct: number;
|
|
@@ -1307,42 +1540,16 @@ interface MinimalSummaryLine {
|
|
|
1307
1540
|
cand?: GitMetadata;
|
|
1308
1541
|
};
|
|
1309
1542
|
exportedTo?: string;
|
|
1310
|
-
/**
|
|
1543
|
+
/**
|
|
1544
|
+
* `pass` (exit 0), `fail` (exit 1: a regression), else `error` (exit 2, or
|
|
1311
1545
|
* 130 when cancelled): no verdict was reached. */
|
|
1312
1546
|
verdict: "pass" | "fail" | "error";
|
|
1313
1547
|
exitCode: number;
|
|
1314
1548
|
}
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
command: "compare" | "ci" | "ab";
|
|
1320
|
-
exitCode: number;
|
|
1321
|
-
unmatched?: {
|
|
1322
|
-
baseOnly: Workload[];
|
|
1323
|
-
candOnly: Workload[];
|
|
1324
|
-
};
|
|
1325
|
-
baseGit?: GitMetadata;
|
|
1326
|
-
candGit?: GitMetadata;
|
|
1327
|
-
baseline?: {
|
|
1328
|
-
name: string;
|
|
1329
|
-
path: string;
|
|
1330
|
-
};
|
|
1331
|
-
cached?: number;
|
|
1332
|
-
executed?: number;
|
|
1333
|
-
failed?: number;
|
|
1334
|
-
missingBaseline?: number;
|
|
1335
|
-
exportedTo?: string;
|
|
1336
|
-
}
|
|
1337
|
-
|
|
1338
|
-
export interface MinimalRenderOptions {
|
|
1339
|
-
protocol?: MinimalProtocolContext;
|
|
1340
|
-
}
|
|
1341
|
-
|
|
1342
|
-
export interface MermaidOptions extends VizOptions {
|
|
1343
|
-
topN?: number;
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1549
|
+
/**
|
|
1550
|
+
* One command for `time()`: a string (whitespace-split, no shell), an argv
|
|
1551
|
+
* array, or an object with per-command settings, which is how one command
|
|
1552
|
+
* becomes several labeled workloads (e.g. warm vs cold `prepare`). */
|
|
1346
1553
|
export interface CommandSpec {
|
|
1347
1554
|
command: string | string[];
|
|
1348
1555
|
label?: string;
|
|
@@ -1355,25 +1562,29 @@ export interface CommandSpec {
|
|
|
1355
1562
|
/** Overrides `TimeOptions.ignoreExitCodes` for this command. */
|
|
1356
1563
|
ignoreExitCodes?: number[];
|
|
1357
1564
|
}
|
|
1358
|
-
|
|
1359
1565
|
export interface TimeOptions {
|
|
1360
1566
|
commands: (string | string[] | CommandSpec)[];
|
|
1361
|
-
/**
|
|
1362
|
-
*
|
|
1567
|
+
/**
|
|
1568
|
+
* Runs unmeasured before every trial (warmup and instrumented included),
|
|
1569
|
+
* in `cwd`/`env`: a command spawned and awaited, or a function. */
|
|
1363
1570
|
prepare?: PrepareHook;
|
|
1364
|
-
/**
|
|
1571
|
+
/**
|
|
1572
|
+
* Take timing from a number in each command's own output (e.g. a build
|
|
1365
1573
|
* tool's `built in 342ms`) instead of its wall clock. */
|
|
1366
1574
|
timeSource?: TimeSource;
|
|
1367
1575
|
/** Exact trial count; when set, `budgetMs` is ignored. */
|
|
1368
1576
|
samples?: number;
|
|
1369
|
-
/**
|
|
1577
|
+
/**
|
|
1578
|
+
* Wall-clock budget for the sampling loop, ms. Default: ~3s when neither
|
|
1370
1579
|
* `samples` nor `budgetMs` is given. */
|
|
1371
1580
|
budgetMs?: number;
|
|
1372
1581
|
/** Floor on trials when no exact `samples` is given. */
|
|
1373
1582
|
minSamples?: number;
|
|
1374
1583
|
warmup?: number;
|
|
1375
|
-
/**
|
|
1376
|
-
*
|
|
1584
|
+
/**
|
|
1585
|
+
* Round-robin trials across commands instead of finishing each command
|
|
1586
|
+
* first, so drift hits every command equally. Default: true with 2+
|
|
1587
|
+
* commands. */
|
|
1377
1588
|
interleave?: boolean;
|
|
1378
1589
|
cwd?: string;
|
|
1379
1590
|
env?: Record<string, string>;
|
|
@@ -1381,19 +1592,25 @@ export interface TimeOptions {
|
|
|
1381
1592
|
heap?: boolean;
|
|
1382
1593
|
cpuIntervalUs?: number;
|
|
1383
1594
|
outDir?: string;
|
|
1384
|
-
/**
|
|
1595
|
+
/**
|
|
1596
|
+
* Measure the machine's noise floor first (default true, ~200ms) and stamp
|
|
1385
1597
|
* it on the document as `environment`. */
|
|
1386
1598
|
noiseCheck?: boolean;
|
|
1387
|
-
/**
|
|
1599
|
+
/**
|
|
1600
|
+
* SIGKILLs a trial (or prepare hook) still running after this many ms. No
|
|
1388
1601
|
* default. A timed-out trial contributes no sample. */
|
|
1389
1602
|
timeoutMs?: number;
|
|
1390
|
-
/**
|
|
1391
|
-
*
|
|
1392
|
-
*
|
|
1603
|
+
/**
|
|
1604
|
+
* Abort kills in-flight trials, schedules no more, and resolves (never
|
|
1605
|
+
* rejects) with the completed measurements plus an `aborted` warning on
|
|
1606
|
+
* the last one. */
|
|
1393
1607
|
signal?: AbortSignal;
|
|
1394
|
-
/**
|
|
1395
|
-
*
|
|
1608
|
+
/**
|
|
1609
|
+
* Exit codes to treat as success (hyperfine's `--ignore-failure`): the
|
|
1610
|
+
* trial still contributes its sample and gets no `nonzero-exit` warning.
|
|
1611
|
+
* */
|
|
1396
1612
|
ignoreExitCodes?: number[];
|
|
1397
1613
|
}
|
|
1398
|
-
|
|
1399
1614
|
export declare function time(opts: TimeOptions): Promise<ProfileDocument>;
|
|
1615
|
+
/** Identity function that types an `ostia.config.ts` default export. */
|
|
1616
|
+
export declare function defineConfig(config: OstiaConfigInput): OstiaConfigInput;
|