ostia 0.4.0 → 0.6.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.
Files changed (64) hide show
  1. package/README.md +31 -30
  2. package/docs/agent-protocol.md +13 -9
  3. package/docs/cli.md +174 -126
  4. package/docs/config.md +2 -2
  5. package/docs/document-schema.md +15 -12
  6. package/docs/library.md +32 -21
  7. package/docs/preload-recipes.md +4 -4
  8. package/docs/statistics.md +14 -13
  9. package/index.d.ts +202 -60
  10. package/package.json +1 -1
  11. package/src/ab/ab-runner.ts +6 -6
  12. package/src/ab/index.ts +56 -6
  13. package/src/ab/unpaired.ts +54 -0
  14. package/src/bench/index.ts +40 -3
  15. package/src/bench/registry.ts +6 -4
  16. package/src/bench/run-tasks.ts +16 -2
  17. package/src/bench/runner.ts +10 -3
  18. package/src/bench/support.ts +8 -4
  19. package/src/bench/sweep.ts +2 -2
  20. package/src/cache/fingerprint.ts +2 -2
  21. package/src/capture/bunflags.ts +2 -2
  22. package/src/capture/cpu.ts +2 -2
  23. package/src/capture/heap-parse.ts +2 -2
  24. package/src/ci/index.ts +39 -48
  25. package/src/cli/agent.ts +54 -0
  26. package/src/cli/flags.ts +58 -9
  27. package/src/cli/help.ts +670 -245
  28. package/src/cli/main.ts +2 -3
  29. package/src/cli/output.ts +17 -14
  30. package/src/cli/run.ts +317 -92
  31. package/src/compare/index.ts +4 -4
  32. package/src/config/index.ts +14 -10
  33. package/src/config/validate.ts +4 -4
  34. package/src/glob.ts +2 -2
  35. package/src/index.ts +3 -2
  36. package/src/ir/document.ts +2 -2
  37. package/src/ir/types.ts +49 -24
  38. package/src/measure/alloc.ts +2 -2
  39. package/src/measure/cpu.ts +2 -2
  40. package/src/measure/environment.ts +11 -6
  41. package/src/measure/inprocess.ts +14 -10
  42. package/src/measure/instructions.ts +2 -2
  43. package/src/measure/noise.ts +51 -13
  44. package/src/measure/paired.ts +2 -2
  45. package/src/measure/peak.ts +4 -4
  46. package/src/measure/timing.ts +27 -6
  47. package/src/profile.ts +6 -4
  48. package/src/renderers/collapsed.ts +2 -2
  49. package/src/renderers/concise.ts +148 -0
  50. package/src/renderers/format.ts +13 -4
  51. package/src/renderers/human.ts +402 -0
  52. package/src/renderers/index.ts +9 -2
  53. package/src/renderers/markdown.ts +2 -2
  54. package/src/renderers/mermaid.ts +2 -2
  55. package/src/renderers/minimal.ts +8 -7
  56. package/src/renderers/relative.ts +2 -2
  57. package/src/renderers/select.ts +2 -2
  58. package/src/renderers/terminal.ts +1178 -383
  59. package/src/renderers/types.ts +3 -0
  60. package/src/spawn/index.ts +47 -14
  61. package/src/stats/bootstrap.ts +2 -2
  62. package/src/stats/index.ts +2 -2
  63. package/src/terminal.ts +321 -0
  64. package/src/time.ts +124 -20
package/docs/cli.md CHANGED
@@ -10,14 +10,14 @@ ostia ci run configured workloads against a baseline, gate
10
10
  ostia baseline save|list|show manage baseline documents
11
11
  ```
12
12
 
13
- Every command takes `--help`; `ostia --version` (or `-v`) prints the
14
- version.
15
- A flag's value can follow it (`--format minimal`)
16
- or be attached (`--format=minimal`);
17
- `--ignore-failure[=CODES]` only takes the attached form.
13
+ Every command takes `--help`; `ostia --version` (or `-v`) prints
14
+ the version.
15
+ A flag's value can follow it (`--format events`)
16
+ or be attached (`--format=events`); `--ignore-failure[=CODES]` only
17
+ takes the attached form.
18
18
  A flag that needs a value and is given none is a usage error (exit 2).
19
- Exit codes and the machine-readable error line are described in
20
- [agent-protocol.md](agent-protocol.md).
19
+ Exit codes and the machine-readable error line are described
20
+ in [agent-protocol.md](agent-protocol.md).
21
21
 
22
22
  `bench`, `ab`, `compare`, `ci` and `baseline` read the config file
23
23
  ([config.md](config.md)): `ostia.config.ts`, else `ostia.config.json`,
@@ -35,9 +35,19 @@ or a flag with nothing to act on
35
35
  format) exits 2 with `invalid-flag`.
36
36
 
37
37
  Output formats shared by `time`, `bench`, `ab`, `compare` and `ci`:
38
- `table` (default), `json`, `jsonl`, `markdown`, `minimal`.
38
+ `table` (default), `concise`, `events`, `json`, `jsonl`, `markdown`.
39
+ `--json` is short for `--format json`.
40
+ `minimal` still names `events`, and `agent` names `concise`.
39
41
  `report` additionally accepts the CPU visualization formats.
40
42
 
43
+ With no `--format`, a command run by a coding agent prints `concise`:
44
+ one of `AGENT`, `AI_AGENT`, `CLAUDECODE`,
45
+ `CODEX_CI` or `CODEX_THREAD_ID` is set, and not to `0`,
46
+ the variables svelte-typecheck and svelte-lint read.
47
+ A line on stderr says so.
48
+ `OSTIA_FORMAT` sets the default for any caller,
49
+ and `--format` always wins.
50
+
41
51
  ## `ostia time`
42
52
 
43
53
  ```
@@ -53,6 +63,9 @@ ostia time [flags] -- <argv...>
53
63
  | `--warmup N` | Discarded warmup trials per command (default: 3). |
54
64
  | `--no-interleave` | Run each command's trials to completion before the next command starts. |
55
65
  | `--prepare CMD` | Run `CMD` before every trial, unmeasured. Once (all commands) or once per command. |
66
+ | `--shell SH` | Run each command, and `--prepare`, as `SH -c CMD` (`sh`, `bash`), so env prefixes, pipes, `&&` and `$(...)` work; without it, a command is split on whitespace and run with no shell. The shell's startup is measured, printed and stored as `shell`, and not subtracted: two commands under one shell pay it alike. |
67
+ | `--save-output DIR` | Save each trial's stdout and stderr under `DIR`, a folder per command, as `trial-N.log` and `warmup-N.log`, written after the trial's clock stops. Each trial's `outputPath` names its file. |
68
+ | `--show-output` | Pass each trial's output to stderr, for debugging; stdout keeps ostia's own output. |
56
69
  | `--time-source REGEX` | Take each trial's time from capture group 1 of the command's output. |
57
70
  | `--time-unit UNIT` | Unit of the `--time-source` number: `ns`, `us`, `ms` (default), `s`. Needs `--time-source`. |
58
71
  | `--cpu` | Capture one extra CPU-profile trial per command. |
@@ -61,10 +74,12 @@ ostia time [flags] -- <argv...>
61
74
  | `--timeout MS` | SIGKILL a trial or `--prepare` hook that runs longer than `MS`. No default. |
62
75
  | `--ignore-failure[=CODE,...]` | Treat these exit codes (bare: every code) as success. |
63
76
  | `--out-dir PATH` | Artifact directory (default: `node_modules/.cache/ostia`). |
64
- | `--no-noise-check` | Skip the ~200ms noise-floor measurement. |
77
+ | `--no-noise-check` | Skip the noise-floor checks: 25 to 50 ms at the start, until the reference loop's median holds, and 25 ms at the end, for drift. |
78
+ | `--noise-budget MS` | Sample the noise floor for exactly `MS` at the start and at the end, with no early stop. |
65
79
  | `--export-json PATH` | Write the document to `PATH`. |
66
- | `--format FORMAT` | `table`, `json`, `jsonl`, `markdown`, `minimal`. |
80
+ | `--format FORMAT` | `table`, `concise`, `events`, `json`, `jsonl`, `markdown`; `--json` for `--format json`. |
67
81
  | `--quiet` | Don't print the report. |
82
+ | `--color` / `--no-color` | Force color in the table on or off. Default: on when stdout is a terminal no coding agent reads, and `NO_COLOR` isn't set. |
68
83
 
69
84
  ### Commands
70
85
 
@@ -88,15 +103,15 @@ With several commands, each gets its own N or its own budget.
88
103
 
89
104
  With 2+ commands, trials run round-robin
90
105
  (one trial of each command, repeated) so drift over the run
91
- (thermal throttling, a busy neighbor process) affects every command
92
- equally.
106
+ (thermal throttling, a busy neighbor process) affects every
107
+ command equally.
93
108
  Each such measurement carries `interleaved: true`.
94
109
  `--no-interleave` runs the commands one after another.
95
110
 
96
111
  ### Failures
97
112
 
98
- A command's trial loop stops at its first non-zero exit that isn't
99
- ignored.
113
+ A command's trial loop stops at its first non-zero exit that
114
+ isn't ignored.
100
115
  That trial's sample is kept, the measurement carries a `nonzero-exit`
101
116
  warning, and `ostia time` exits 2.
102
117
  The same rule applies in `ostia ci`: any non-ignored non-zero exit,
@@ -111,8 +126,8 @@ ostia time --ignore-failure "./flaky-exit.sh" # every exit code counts as s
111
126
  A timed-out trial contributes no sample and the measurement carries a
112
127
  `timeout` warning.
113
128
  If every trial of a command times out, the command has no timing stats,
114
- prints like a skipped workload, and the run exits 2 with error code
115
- `timeout`.
129
+ prints like a skipped workload, and the run exits 2 with error
130
+ code `timeout`.
116
131
  `--timeout` also applies to `--prepare` hooks;
117
132
  a hook that times out aborts the run.
118
133
  A timed-out trial has no exit code, so it is not a failing exit:
@@ -170,33 +185,31 @@ A match with no group 1, or a non-numeric capture, is an error.
170
185
  The budget always counts wall time.
171
186
 
172
187
  The time source is part of the workload id,
173
- so timing the same command both ways gives two workloads with two
174
- verdicts.
188
+ so timing the same command both ways gives two workloads with
189
+ two verdicts.
175
190
 
176
191
  ### `--cpu` / `--heap`
177
192
 
178
193
  Each adds one instrumented trial per command after the timing trials,
179
194
  labeled as a separate measurement (`phase: "cpu"` / `"heap"`)
180
195
  and never mixed into timing.
181
- The raw `.cpuprofile` / `.heapsnapshot` is written under
182
- `<out-dir>/artifacts/`.
183
-
184
- ```
185
- CPU capture - bun fixtures/work.ts (instrumented, 1000µs interval, diagnostic wall 300.558ms)
186
- 100.0% 292.61ms self hashLoop
187
- 0.0% 0.00ms self (root)
188
- 0.0% 0.00ms self (module)
189
- artifact: /tmp/ostia-hot/artifacts/run_0fe944c450b24bfc-cpu.cpuprofile
190
- ```
196
+ The raw `.cpuprofile` / `.heapsnapshot` is written
197
+ under `<out-dir>/artifacts/`.
191
198
 
192
199
  ```
193
- Heap snapshot - bun fixtures/allocate.ts (instrumented, 2516 objects, 117.19KiB)
194
- 1369 string
195
- 423 code
196
- 319 closure
197
- 216 object shape
198
- 105 hidden
199
- artifact: /tmp/ostia-heap/artifacts/run_608f71a09a849cca-heap.heapsnapshot
200
+ CPU profile bun fixtures/work.ts · 14 samples at 1.00 ms
201
+ function self share
202
+ hotInner 21.0 ms 100%
203
+ /tmp/ostia-hot/artifacts/run_6dbc7f8302eedc8c-cpu.cpuprofile
204
+
205
+ Heap snapshot bun fixtures/work.ts · 1.53K objects · 109 KiB
206
+ type objects
207
+ code 430
208
+ string 344
209
+ closure 326
210
+ object shape 218
211
+ hidden 129
212
+ /tmp/ostia-hot/artifacts/run_6dbc7f8302eedc8c-heap.heapsnapshot
200
213
  ```
201
214
 
202
215
  Use `ostia report --format collapsed|mermaid|speedscope|cpuprofile` on
@@ -226,10 +239,12 @@ ostia bench [flags] <suite.ts...>
226
239
  | `--timeout MS` | SIGKILL a suite (or isolated task) process after `MS`. No default. |
227
240
  | `--out-dir PATH` | Scratch directory (default: `node_modules/.cache/ostia`). |
228
241
  | `--config PATH` | Config file to read instead of discovery. |
229
- | `--no-noise-check` | Skip the ~200ms noise-floor measurement. |
242
+ | `--no-noise-check` | Skip the noise-floor checks: 25 to 50 ms at the start, until the reference loop's median holds, and 25 ms at the end, for drift. |
243
+ | `--noise-budget MS` | Sample the noise floor for exactly `MS` at the start and at the end, with no early stop. |
230
244
  | `--export-json PATH` | Write the document to `PATH`. |
231
- | `--format FORMAT` | `table`, `json`, `jsonl`, `markdown`, `minimal`. |
245
+ | `--format FORMAT` | `table`, `concise`, `events`, `json`, `jsonl`, `markdown`; `--json` for `--format json`. |
232
246
  | `--quiet` | Don't print the report. |
247
+ | `--color` / `--no-color` | Force color in the table on or off. Default: on when stdout is a terminal no coding agent reads, and `NO_COLOR` isn't set. |
233
248
 
234
249
  With no suite files, `ostia bench` uses the config's `bench` section
235
250
  (`suites` globs and the rest).
@@ -312,11 +327,11 @@ and loops the task long enough to collect about 2,000 samples:
312
327
  and never less than one whole call.
313
328
  The header of each CPU section shows the sample count;
314
329
  below 1,000 the measurement carries a `low-sample-count` warning
315
- (`{ samples, target, intervalUs }`),
316
- since frame shares that thin move by several points between runs.
330
+ (`{ samples, target, intervalUs }`), since frame shares that thin move
331
+ by several points between runs.
317
332
  When more than 20% of its samples are in the llint/baseline tiers,
318
- it carries a `jit-cold` warning
319
- (`{ llintPct, baselinePct, dfgPct, ftlPct }`).
333
+ it carries a `jit-cold`
334
+ warning (`{ llintPct, baselinePct, dfgPct, ftlPct }`).
320
335
  With CPU evidence on both sides, `compare` reports per-frame deltas.
321
336
 
322
337
  Self time is attributed to the frame the JIT compiled,
@@ -380,17 +395,16 @@ this slack, so read small differences with that in mind;
380
395
  `--peak-mem` is for calls that allocate megabytes.
381
396
 
382
397
  ```
383
- Task Median Spread Range Retained/op Peak mem Relative
384
- -----------------------------------------------------------------------------------------------------
385
- mem:
386
- garbage 40MB 1.29 ms 1.38 ms…6.01 ms 1.17 ms…6.73 ms 39B 38.22MiB 4291943.33× slower
387
- ! slow-first-run
388
- retains 8KB/call 819.4 ns 1027.8 ns…20563.9 ns 493.1 ns…357930.6 ns 7.58KiB 48.00KiB 2731.39× slower
389
- noop 0.30 ns 0.31 ns…0.42 ns 0.29 ns…5.40 ns 0B 0B 1.00×
398
+ task median noise instr/call retained/op peak mem vs fastest
399
+ mem
400
+ ├ garbage 40MB 3.10 ms ±35.8% 18.1M 222 B 38.3 MiB 5.34M×
401
+ ├ retains… 1.93 µs ±20.2% 9.24K 7.73 KiB 0 B 3.33K×
402
+ └ noop 0.58 ns ±8.8% 7 0 B 0 B fastest
390
403
  ```
391
404
 
392
405
  The first task allocates and drops a 40MB array per call:
393
- `Retained/op` sees nothing, `Peak mem` sees all of it.
406
+ `retained/op` sees nothing, `peak mem` sees all of it.
407
+ A name that would push a row past 80 columns is cut at a word.
394
408
  The second keeps 8KB per call alive, which both see.
395
409
  Byte counts print 1024-based (`B`, `KiB`, `MiB`) everywhere,
396
410
  heap snapshot summaries included.
@@ -404,8 +418,8 @@ A cache that grows the heap elsewhere in the process shows in
404
418
  `heapUsedBefore` of every task after it.
405
419
  `ostia compare` reports either reading when it moves 10%
406
420
  or more
407
- (`+9.4% median` next to
408
- `heap used before 12.00MiB → 16.80MiB (+40.0%)`).
421
+ (`+9.4% median` next
422
+ to `heap used before 12.00MiB → 16.80MiB (+40.0%)`).
409
423
  Bun exposes neither a JS allocation counter nor GC counts
410
424
  or pause times, so ostia can't report bytes allocated per call
411
425
  or GC activity.
@@ -429,14 +443,14 @@ Object.assign(globalThis, { document: dom.window.document, window: dom.window })
429
443
  ostia bench --preload ./bench/jsdom-setup.ts bench/*.dom.bench.ts
430
444
  ```
431
445
 
432
- Complete jsdom, happy-dom and Svelte-plugin setups are in
433
- [preload-recipes.md](preload-recipes.md).
446
+ Complete jsdom, happy-dom and Svelte-plugin setups are
447
+ in [preload-recipes.md](preload-recipes.md).
434
448
  To give only some suite files a preload (the DOM ones, say),
435
- set it per group with the config's
436
- [`bench.projects`](config.md#projects).
449
+ set it per group with the
450
+ config's [`bench.projects`](config.md#projects).
437
451
 
438
- `--bun-flags FLAGS` passes flags to the `bun` process that runs each
439
- suite.
452
+ `--bun-flags FLAGS` passes flags to the `bun` process that runs
453
+ each suite.
440
454
  The common case is a package whose `exports` map branches on a condition
441
455
  Bun doesn't set by default: Svelte 5 resolves to its server build
442
456
  without `--conditions=browser`, and mounting a component then fails.
@@ -449,11 +463,20 @@ Space-separated flags within one value are split and all passed.
449
463
 
450
464
  ### Table layout
451
465
 
452
- Grouped tasks print under their group name;
466
+ The first line is the verdict: how many tasks, the fastest and its time,
467
+ and how many warnings.
468
+ A dim line under it names the machine and the suite.
469
+ Grouped tasks print under their group's name, as a tree;
453
470
  ungrouped tasks and subprocess commands print flat.
454
- `Relative` compares each task with its group's `{ baseline: true }`
455
- task, or else the group's fastest task.
456
- `Instr/call` is the median number of instructions each call retired,
471
+ `noise` is ± the median absolute deviation, as a percent of the median.
472
+ `vs fastest` compares each task with its group's fastest task;
473
+ when a group has a `{ baseline: true }` task,
474
+ the column is `vs baseline` and compares with that.
475
+ A warning prints in words under its row,
476
+ with its fix where there is one; outliers print gray
477
+ unless dropping them moves the median past the noise.
478
+ The spread (p75…p99) and range stay in `--json` and `markdown`.
479
+ `instr/call` is the median number of instructions each call retired,
457
480
  where the machine counts them (see `ostia ab`'s "Instructions"):
458
481
  unlike time, it barely moves on a loaded machine.
459
482
 
@@ -490,11 +513,13 @@ ostia ab [flags] <suite.ts...>
490
513
  | `--keep-trees N` | Base trees to keep cached (default: 5). See "The base tree". |
491
514
  | `--clean` | Remove every cached base tree, then exit. |
492
515
  | `--config PATH` | Config file to read instead of discovery. |
493
- | `--no-noise-check` | Skip the ~200ms noise-floor measurement. |
516
+ | `--no-noise-check` | Skip the noise-floor checks: 25 to 50 ms at the start, until the reference loop's median holds, and 25 ms at the end, for drift. |
517
+ | `--noise-budget MS` | Sample the noise floor for exactly `MS` at the start and at the end, with no early stop. |
494
518
  | `--export-json PATH` | Write the document to `PATH`. |
495
- | `--format FORMAT` | `table`, `json`, `jsonl`, `markdown`, `minimal`. |
496
- | `--progress` / `--no-progress` | Print progress to stderr. Default: on when stderr is a terminal and `--quiet` isn't given. |
519
+ | `--format FORMAT` | `table`, `concise`, `events`, `json`, `jsonl`, `markdown`; `--json` for `--format json`. |
520
+ | `--progress` / `--no-progress` | Print progress to stderr. Default: on when stderr is a terminal, the format is `table`, no coding agent runs it, and `--quiet` isn't given. |
497
521
  | `--quiet` | Don't print the report. |
522
+ | `--color` / `--no-color` | Force color in the table on or off. Default: on when stdout is a terminal no coding agent reads, and `NO_COLOR` isn't set. |
498
523
 
499
524
  `ostia ab` answers "did my change make this slower?"
500
525
  on a machine too noisy for two runs minutes apart to agree.
@@ -517,20 +542,31 @@ ostia ab bench/*.ts --filter 'source map' --rounds 21
517
542
  ```
518
543
 
519
544
  ```
520
- A/B: working tree vs HEAD (26e7d0d) · 15 rounds · threshold 10% · geomean threshold 1.5%
545
+ fail · 1 regressed · geomean +76.2% · 1 unchanged
546
+ HEAD 26e7d0d vs working tree · 15 rounds · thresholds 10%, geomean 1.5%
521
547
 
522
- Task Base Candidate Change p25…p75 Instr Verdict
523
- ----------------------------------------------------------------------------
524
- g:
525
- work 66.9 µs 143.0 µs +113.0% +104.8%…+123.6% +100.1% regressed, confirmed (repeats: +103.1%, +101.8%)
526
- same 87.1 µs 87.9 µs -2.2% -5.1%…+3.2% 0.0%
548
+ task base candidate change noise instr verdict
549
+ dedupe
550
+ ├ naive (indexOf scan… 131 µs 147 µs ~0% ±13.3% 0.0%
551
+ └ Set-based (O(n)) 47.8 µs 141 µs +201% ±22.2% +257% regressed
552
+ repeats +166%, +289%
527
553
 
528
- Output differs from the base (1):
529
- g/work
530
-
531
- Geomean +41.0% (threshold 1.5%) · 1 regressed, 0 improved, 1 unchanged of 2 · fail
554
+ ✗ A/B fails: dedupe/Set-based (O(n)) regressed +201%
555
+ profile it: ostia bench suite.ts --cpu --filter 'dedupe/Set-based \(O\(n\)\)'
532
556
  ```
533
557
 
558
+ The first line is the gate's verdict.
559
+ `change` is the median of the per-round ratios,
560
+ and `noise` their median absolute deviation;
561
+ a change inside the noise reads `~0%`.
562
+ Past 10×, a change prints as a multiple (`501×`).
563
+ Color marks only what the gate judged: green improved, red regressed.
564
+ A flagged task that a fresh process didn't confirm reads `regressed?`
565
+ and stays out of the verdict.
566
+ Repeats, a changed output, memory readings and warnings print under the
567
+ task's row.
568
+ The last line names what failed and the next step.
569
+
534
570
  **The base tree.**
535
571
  The ref's commit is extracted with `git archive` into `.ostia/ab/<sha>/`
536
572
  at the project root (the first 12 characters of the sha) once
@@ -556,8 +592,8 @@ The base tree's paths are about 20 characters longer than the working
556
592
  tree's, so code that does string work on absolute paths
557
593
  (joining, relativizing, hashing them) does slightly more on the base
558
594
  side and can read as a few percent faster on the candidate;
559
- in one path-heavy task, each extra character cost 0.3–0.45% more
560
- instructions.
595
+ in one path-heavy task, each extra character cost 0.3–0.45%
596
+ more instructions.
561
597
  A suite file that doesn't exist at the ref has nothing to pair with:
562
598
  it's listed as a new suite, its tasks are candidate-only
563
599
  and aren't timed, and the run goes on with the other suites.
@@ -573,8 +609,8 @@ Use it when the suites import generated or gitignored files:
573
609
  ostia ab bench/*.ts --base-setup "bun scripts/generate.ts"
574
610
  ```
575
611
 
576
- Each command runs in the tree's counterpart of the current directory,
577
- with:
612
+ Each command runs in the tree's counterpart of the current
613
+ directory, with:
578
614
 
579
615
  - the project's `node_modules` linked into the tree,
580
616
  so build scripts that read `./node_modules/...`
@@ -585,8 +621,8 @@ with:
585
621
  - `OSTIA_AB_SHA`, the base commit, and `OSTIA_AB_CANDIDATE_DIR`,
586
622
  the current directory in the working tree.
587
623
  When the generated files don't depend on the base's code,
588
- copying them is cheaper than building them:
589
- `--base-setup 'cp -R "$OSTIA_AB_CANDIDATE_DIR/src/gen" src/'`.
624
+ copying them is cheaper than building
625
+ them: `--base-setup 'cp -R "$OSTIA_AB_CANDIDATE_DIR/src/gen" src/'`.
590
626
 
591
627
  The tree is cached under `.ostia/ab/<sha>-<hash>/`,
592
628
  where the hash covers the commands, so changing them builds a new tree.
@@ -595,8 +631,8 @@ when every command succeeds, so a failed or interrupted setup never
595
631
  leaves a half-built tree for a later run to reuse.
596
632
  Each command runs in its own process group,
597
633
  and the whole group is killed when the command ends,
598
- times out or is cancelled, so nothing it started in the background keeps
599
- running.
634
+ times out or is cancelled, so nothing it started in the background
635
+ keeps running.
600
636
  A command that exits non-zero (or runs past `--timeout`) stops the run
601
637
  with exit 2 (`command-failed`) and the last 20 lines of its stderr.
602
638
 
@@ -661,8 +697,8 @@ so the candidate was slower in at least three quarters of rounds;
661
697
  `improved` is the mirror image.
662
698
  Pairing can't cancel one thing: how the JIT happened to compile each
663
699
  side's copy of the code in that process,
664
- which can skew a small task by 20% in either direction with tight
665
- quartiles.
700
+ which can skew a small task by 20% in either direction with
701
+ tight quartiles.
666
702
  So each flagged task is measured again in `--confirm` fresh processes,
667
703
  and only counts when every repeat flags it the same way;
668
704
  otherwise it reads `unconfirmed` and counts as unchanged.
@@ -687,10 +723,10 @@ to mean anything.
687
723
  **Errors.**
688
724
  A task that throws, on either side, doesn't stop the suite.
689
725
  It isn't timed, reads `base threw`, `candidate threw`
690
- or `both threw` in the table, and the error's first line is listed under
691
- "Threw".
692
- A throw from a task's `before` or `after` hook counts for that hook's
693
- side.
726
+ or `both threw` in the table, and the error's first line is listed
727
+ under "Threw".
728
+ A throw from a task's `before` or `after` hook counts for that
729
+ hook's side.
694
730
  Each hook runs once: a side whose `before` threw isn't timed
695
731
  or torn down, and every side that was set up is torn down once,
696
732
  even when a hook throws.
@@ -726,8 +762,8 @@ with a load average of 4–6 on 8 cores,
726
762
  rounds of identical code spread −40%…+44%,
727
763
  and a real 5% change can't be told apart.
728
764
  The number of instructions a call retires barely moves with load,
729
- since another process taking the CPU doesn't change what this thread
730
- executes.
765
+ since another process taking the CPU doesn't change what this
766
+ thread executes.
731
767
  So where the machine can count them,
732
768
  `ostia ab` reads the hardware counter of the thread running the task
733
769
  around each batch, and shows the change in instructions per call next to
@@ -794,26 +830,32 @@ For `--peak-mem` it's 1 MiB
794
830
  when a `peak-hidden` warning says memory freed before the call could
795
831
  hide part of its peak, the size of that memory.
796
832
  A memory regression fails the run like a time regression.
797
- Task and group `alloc`/`peakMem` options apply under `ab` as under
798
- `bench`.
833
+ Task and group `alloc`/`peakMem` options apply under `ab` as
834
+ under `bench`.
799
835
  A task that's not comparable gets no memory verdict.
800
- The Change column leaves out the percent when the base reading is under
801
- the floor: a percent of almost nothing means little.
836
+ Each reading prints under its task's row,
837
+ with its verdict when it moved past the threshold;
838
+ a reading that moved less than 10% and wasn't judged isn't shown.
802
839
 
803
840
  ```
804
- Memory:
805
- Task Reading Base Candidate Change Verdict
806
- -------------------------------------------------------------------------
807
- dom:
808
- paint retained/op 0B 21B +21B
809
- paint peak 14.03MiB 2.44MiB -11.59MiB (-82.6%) improved
810
- remember retained/op 21B 7.88KiB +7.86KiB regressed
841
+ task base candidate change noise instr verdict
842
+ dom
843
+ ├ paint 574 µs 75.8 µs -85.7% ±39.7% -87.2% not comparable
844
+ retained/op 10 B → 8 B (-23.2%)
845
+ peak 7.73 MiB → 559 KiB (-92.9%)
846
+ the suite and its output both changed, so it isn't judged
847
+ └ remember 3.46 ns 1.88 µs 501× ±38.1% 156× regressed
848
+ repeats 433×, 336×
849
+ retained/op 22 B → 7.89 KiB (370×) regressed
811
850
  ```
812
851
 
813
852
  **Progress.**
814
853
  A run over many suites, with confirmations, can take many minutes.
815
854
  On a terminal, `ostia ab` shows one progress line on stderr,
816
- replaced as it goes and cleared before the report.
855
+ a bar of how far it is, the step and the seconds,
856
+ replaced as it goes and cleared before the report;
857
+ `time`, `bench` and `ci` do the same.
858
+ A coding agent and a format other than `table` get none.
817
859
  `--progress` turns it on anywhere else too, as one line per step,
818
860
  which is how a script or agent can tell a long run from a stuck one:
819
861
 
@@ -824,7 +866,7 @@ which is how a script or agent can tell a long run from a stuck one:
824
866
  [ab] memory · process 2/6 candidate search/regex
825
867
  ```
826
868
 
827
- Progress never goes to stdout, so `--format minimal` output stays clean.
869
+ Progress never goes to stdout, so `--format events` output stays clean.
828
870
 
829
871
  Exit codes: `0` pass, `1` a confirmed regression,
830
872
  a task that threw on the candidate side only,
@@ -840,8 +882,8 @@ or timed out (`spawn-failed`); `130` Ctrl-C.
840
882
  With no suite files, `ostia ab` uses the config's `bench.suites`,
841
883
  and its `filter`, `preload`, `bunFlags`, `outDir` and `timeoutMs`,
842
884
  and its setup commands from `ab.setup`
843
- (and `ab.metric`, `ab.alloc` and the other `ab` keys; see
844
- [config.md](config.md)).
885
+ (and `ab.metric`, `ab.alloc` and the other `ab` keys;
886
+ see [config.md](config.md)).
845
887
  The sampling settings (`budgetMs`, `samples`, `isolate` and the rest)
846
888
  don't apply.
847
889
 
@@ -857,8 +899,9 @@ ostia compare <candidate.json> --baseline <base.json>
857
899
  | `--baseline PATH` | The base document, when only the candidate is positional. |
858
900
  | `--config PATH` | Config file to take `thresholds` from, instead of discovery. |
859
901
  | `--export-json PATH` | Write the candidate document, with comparisons, to `PATH`. |
860
- | `--format FORMAT` | `table`, `json`, `jsonl`, `markdown`, `minimal`. |
902
+ | `--format FORMAT` | `table`, `concise`, `events`, `json`, `jsonl`, `markdown`; `--json` for `--format json`. |
861
903
  | `--quiet` | Don't print the report. |
904
+ | `--color` / `--no-color` | Force color in the table on or off. Default: on when stdout is a terminal no coding agent reads, and `NO_COLOR` isn't set. |
862
905
 
863
906
  Exactly two document paths are taken (one with `--baseline`);
864
907
  a third is a usage error.
@@ -936,22 +979,22 @@ the same rows the table and markdown print:
936
979
  `verdict` is `improved`, `unchanged`, `regressed`,
937
980
  `missing-base` (candidate only) or `missing-cand` (base only).
938
981
  `pass` is whether the comparison passed the gate,
939
- frames and heap types included; one-sided tasks have neither `pass` nor
940
- `timing`.
982
+ frames and heap types included; one-sided tasks have neither `pass`
983
+ nor `timing`.
941
984
  Frame and heap-type deltas and warnings stay on the `Comparison` named
942
985
  by `comparisonId`.
943
986
 
944
987
  When the documents differ in OS, architecture, Bun version,
945
988
  CPU model or core count, every comparison carries an
946
- `environment-mismatch` warning; table and markdown print it once in the
947
- header.
989
+ `environment-mismatch` warning; table and markdown print it once in
990
+ the header.
948
991
 
949
992
  Workloads are compared, and listed, in the candidate document's order.
950
993
 
951
994
  Exit codes: `0` pass, `1` at least one workload failed
952
995
  (timing regression, or a CPU frame / heap type over its threshold),
953
- `2` zero workloads matched (`no-matches`) or a document failed to load
954
- (`document-load-failed`).
996
+ `2` zero workloads matched (`no-matches`) or a document failed to
997
+ load (`document-load-failed`).
955
998
  How verdicts are decided: [statistics.md](statistics.md).
956
999
 
957
1000
  ## `ostia report`
@@ -963,6 +1006,7 @@ ostia report <document.json> [flags]
963
1006
  | Flag | Meaning |
964
1007
  |---|---|
965
1008
  | `--format FORMAT` | See below (default: `table`). |
1009
+ | `--color` / `--no-color` | Force color in the table on or off. Default: on when stdout is a terminal no coding agent reads, and `NO_COLOR` isn't set. |
966
1010
  | `--measurement ID` | Visualization formats only: render only this measurement (default: every CPU measurement). |
967
1011
  | `--out-dir PATH` | Visualization formats only: write files here instead of stdout. |
968
1012
 
@@ -975,14 +1019,15 @@ error (exit 2).
975
1019
  | `json` | The document, pretty-printed (same bytes as `--export-json`) |
976
1020
  | `jsonl` | One `kind: "document"` header line, then one `kind: "measurement"` line per measurement |
977
1021
  | `markdown` | Report for humans and agents |
978
- | `minimal` | One JSON object per timing measurement ([agent-protocol.md](agent-protocol.md)) |
1022
+ | `concise` | One line per task, then its warnings; alias `agent` |
1023
+ | `events` | One JSON object per timing measurement ([agent-protocol.md](agent-protocol.md)); alias `minimal` |
979
1024
  | `collapsed` | Folded stacks, `root;a;b 42`, for `flamegraph.pl` and similar tools |
980
1025
  | `mermaid` | Call tree, top 15 frames by total time |
981
1026
  | `speedscope` | Sampled-profile JSON for speedscope.app |
982
1027
  | `cpuprofile` | The original `.cpuprofile` artifact, verbatim (`cpu-prof`/`inspector` origins only) |
983
1028
 
984
- A visualization format on a document with no CPU evidence exits 2 with
985
- `no-cpu-evidence`.
1029
+ A visualization format on a document with no CPU evidence exits 2
1030
+ with `no-cpu-evidence`.
986
1031
 
987
1032
  ```
988
1033
  $ ostia report doc.json --format collapsed
@@ -1024,22 +1069,25 @@ ostia ci [flags]
1024
1069
  | `--baseline NAME` | Baseline to compare against (default: config `baseline`, or `main`). |
1025
1070
  | `--save-baseline` | After a pass, write this run as the new baseline at the same path. Always measures fresh (see below). |
1026
1071
  | `--config PATH` | Config file to read instead of discovery. |
1027
- | `--no-noise-check` | Skip the ~200ms noise-floor measurement. |
1072
+ | `--no-noise-check` | Skip the noise-floor checks: 25 to 50 ms at the start, until the reference loop's median holds, and 25 ms at the end, for drift. |
1028
1073
  | `--export-json PATH` | Write the candidate document, with comparisons, to `PATH`. |
1029
- | `--format FORMAT` | `table`, `json`, `jsonl`, `markdown`, `minimal`. |
1074
+ | `--format FORMAT` | `table`, `concise`, `events`, `json`, `jsonl`, `markdown`; `--json` for `--format json`. |
1030
1075
  | `--quiet` | Don't print the report. |
1076
+ | `--color` / `--no-color` | Force color in the table on or off. Default: on when stdout is a terminal no coding agent reads, and `NO_COLOR` isn't set. |
1031
1077
 
1032
1078
  `ostia ci` loads the config ([config.md](config.md)),
1033
1079
  measures every workload, compares against `<baselineDir>/<name>.json`,
1034
1080
  and gates on the result.
1035
1081
 
1036
1082
  ```
1037
- 1 workloads
1038
- 0 cached
1039
- 1 executed
1040
- 1 passed 0 regressed
1083
+ pass · 2 unchanged · geomean -9.0%
1084
+ baseline main · 0 cached, 2 executed · threshold 5.0%
1085
+
1086
+ task base candidate change verdict
1087
+ startup 16.1 ms 15.4 ms -4.5%
1088
+ version 12.3 ms 10.7 ms -13.3%
1041
1089
 
1042
- Profile CI: ✓
1090
+ ✓ Profile CI passes · 2 workloads in 384 ms
1043
1091
  ```
1044
1092
 
1045
1093
  ### Workloads
@@ -1070,8 +1118,8 @@ and the contents of the files matched by `inputs`:
1070
1118
  - no `inputs` field: never cached, always reruns;
1071
1119
  - `inputs: []`: depends on nothing, cached until the command
1072
1120
  or settings change;
1073
- - `inputs: ["src/**/*.ts", "/abs/path/data.bin"]`:
1074
- reused while the matched files' contents are unchanged.
1121
+ - `inputs: ["src/**/*.ts", "/abs/path/data.bin"]`: reused
1122
+ while the matched files' contents are unchanged.
1075
1123
  Absolute paths work.
1076
1124
  Globs match dotfiles, but wildcards skip `node_modules`,
1077
1125
  `.git` and `.ostia/ab` (`ostia ab`'s base trees)
@@ -1178,8 +1226,8 @@ An option that means the same thing has the same name everywhere:
1178
1226
  the CLI flag is its kebab-case form
1179
1227
  (`timeoutMs` is `--timeout`, `outDir` is `--out-dir`, `cpuIntervalUs` is
1180
1228
  `--cpu-interval`), and the config key and library option are identical.
1181
- The defaults differ on purpose where the commands measure different
1182
- things:
1229
+ The defaults differ on purpose where the commands measure
1230
+ different things:
1183
1231
 
1184
1232
  | Setting | `time` | `bench` / `ci` suites | `ab` |
1185
1233
  |---|---|---|---|
package/docs/config.md CHANGED
@@ -57,8 +57,8 @@ export default defineConfig({
57
57
  A config that isn't valid JSON, isn't an object,
58
58
  has no default export (`.ts`), uses a renamed field,
59
59
  or has a value of the wrong type fails with error code `config-invalid`
60
- (exit 2); the message names the key
61
- (`"bench.jobs" must be a positive integer or "auto", got "many"`).
60
+ (exit 2); the message names the
61
+ key (`"bench.jobs" must be a positive integer or "auto", got "many"`).
62
62
  The top-level `runs` field was renamed to `samples`;
63
63
  a config that still has `runs` is rejected with a message saying so.
64
64