@ac-bench/measure-resource 0.2.1 → 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/CHANGELOG.md CHANGED
@@ -1,5 +1,93 @@
1
1
  # @ac-bench/measure-resource
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5c203e7: Browser entries. Each measure package and `@ac-bench/util` adds a `"browser"`
8
+ condition to its `"."` export (`index.browser.ts`, mirrored in
9
+ `publishConfig`), with the same registration API and no `node:` import, so a
10
+ suite mixing measures bundles for a page. What a page cannot do fails the case
11
+ alone with `UnsupportedInRuntimeError` (`unsupported-in-runtime`, new in
12
+ `@ac-bench/core/runner`): duration's spawned processes (per-iteration
13
+ processes, command cases, spawn baselines), jitter's event-loop monitor,
14
+ constant-time's nanosecond clock. Each plugin's `supportsRuntime` lets the
15
+ parent skip what cannot run without a launch: duration runs everywhere,
16
+ resource in Node and Chromium-family runtimes, jitter and constant-time in
17
+ Node only.
18
+
19
+ Resource measures in Chromium through `performance.memory` (allocation source
20
+ `browser-heap-growth`): its `scheduling.browser` asks for
21
+ `--enable-precise-memory-info` and `--js-flags=--expose-gc
22
+ --min-semi-space-size=64 --max-semi-space-size=64`, batches are capped below
23
+ half the young generation, an allocation self-check at the first case warns
24
+ `allocation-probe-failed` when the counter is off by more than 10 %, and CPU
25
+ time, which a page cannot read, is reported 0 with a `cpu-time-unavailable`
26
+ warning. Batches are sized by wall time where CPU time reads 0.
27
+
28
+ `@ac-bench/util` adds `assertSameResult(contender, actual, expected)`: an
29
+ equivalence check for suites meant for browsers (`Object.is` on numbers,
30
+ element-wise on arrays and typed arrays, `isDeepEqual` otherwise), naming the
31
+ contender and the first differing index. Its package now has an `exports` map:
32
+ deep imports are no longer reachable.
33
+
34
+ The measure packages' Node entries now have a side effect (installing their
35
+ Node host), declared in `sideEffects`.
36
+ - 5c203e7: Config sampling, condition results, a streamed archive.
37
+
38
+ - A config's `sampling` is now read: a record of each measure's default
39
+ sampling options (`{ duration: { minRuns: 20 }, resource: { warmup: 5 } }`),
40
+ validated as such. `runBench`'s new `sampling` option forwards a measure's
41
+ entry to each case as `measureOptions.sampling`, which duration and resource
42
+ read through `runSamplingDefaults` (`@ac-bench/core/runner`) under each
43
+ condition's own options. Migration: the old `sampling` type (condition
44
+ options) never had an effect; key it by measure id.
45
+ - A condition's `onEnd` hook receives a second argument,
46
+ `BenchConditionEndContext`, whose `setConditionResult` emits a
47
+ `"condition-result"` for the condition. Jitter uses it: its condition result
48
+ gains `eventLoopDelay` (`meanMs`, `p50Ms`, `p99Ms`, `maxMs`), the event
49
+ loop's own delay over the condition.
50
+ - The json reporter streams its archive: the header and each condition once
51
+ it settles (`ArchiveBuilder.settled()`), the run description, runtimes,
52
+ gates, verdicts and diagnostics at close, so a crashed run keeps every
53
+ settled condition; `recoverJsonArchive(text)` reads such a file back,
54
+ keeping every condition written whole and dropping one cut mid-way. A
55
+ complete file parses as before; its keys are in another order.
56
+
57
+ ### Patch Changes
58
+
59
+ - 5c203e7: The `homepage` points at the @ac-bench documentation site: `measure(1)` for the CLI, the API reference for `core`, `lib` and `gate`, the site's home for the others.
60
+ - Updated dependencies [5c203e7]
61
+ - Updated dependencies [5c203e7]
62
+ - Updated dependencies [5c203e7]
63
+ - Updated dependencies [5c203e7]
64
+ - Updated dependencies [5c203e7]
65
+ - Updated dependencies [5c203e7]
66
+ - Updated dependencies [5c203e7]
67
+ - Updated dependencies [5c203e7]
68
+ - Updated dependencies [5c203e7]
69
+ - Updated dependencies [5c203e7]
70
+ - Updated dependencies [5c203e7]
71
+ - Updated dependencies [5c203e7]
72
+ - Updated dependencies [5c203e7]
73
+ - Updated dependencies [5c203e7]
74
+ - Updated dependencies [5c203e7]
75
+ - Updated dependencies [5c203e7]
76
+ - Updated dependencies [5c203e7]
77
+ - Updated dependencies [5c203e7]
78
+ - Updated dependencies [5c203e7]
79
+ - Updated dependencies [5c203e7]
80
+ - Updated dependencies [5c203e7]
81
+ - Updated dependencies [5c203e7]
82
+ - Updated dependencies [5c203e7]
83
+ - Updated dependencies [5c203e7]
84
+ - @ac-kit/algo@0.7.0
85
+ - @ac-kit/app-report@0.4.0
86
+ - @ac-bench/core@0.5.0
87
+ - @ac-kit/core@0.14.0
88
+ - @ac-kit/math-stats@0.7.0
89
+ - @ac-kit/model-dataset@0.3.1
90
+
3
91
  ## 0.2.1
4
92
 
5
93
  ### Patch Changes
package/README.md CHANGED
@@ -37,6 +37,20 @@ exact: each result says `offHeap: "lower-bound"` (and warns
37
37
  `offHeap: "unknown"` otherwise — no movement seen does not mean none was
38
38
  allocated.
39
39
 
40
- Host-bound: it reads Node's resource-usage and GC instrumentation.
40
+ Node: it reads the process's resource-usage and GC instrumentation.
41
+
42
+ ## In Chromium
43
+
44
+ The `"browser"` export condition selects a portable entry. In a Chromium page
45
+ (`@ac-bench/browser`), allocation is the heap growth of `performance.memory`
46
+ (`allocationSource: "browser-heap-growth"`) between two forced collections:
47
+ the measure asks Chromium for `--enable-precise-memory-info` and
48
+ `--js-flags=--expose-gc --min-semi-space-size=64 --max-semi-space-size=64`, and
49
+ caps each batch's garbage below half that young generation so no scavenge runs
50
+ inside it. An allocation self-check at the first case compares a known
51
+ structure's measured size with its layout and warns `allocation-probe-failed`
52
+ when it is off by more than 10 %. A page cannot read its CPU time, its
53
+ collections or its RSS: CPU reads 0 with a `cpu-time-unavailable` warning.
54
+ Firefox and WebKit expose no heap counter; their conditions are skipped.
41
55
 
42
56
  Run suites with the `measure` CLI from `@ac-bench/cli`.
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Portable half of the counters: the types every host's counters share and the
3
+ * calibration applied to whichever source a host offers. No `node:` import
4
+ * here; the Node sources live in `_counters.ts`, Chromium's in
5
+ * `_browser-host.ts`.
6
+ */
7
+ /** One reading of the counters every resource figure is derived from. */
8
+ export type ResourceCounters = {
9
+ cpuUserUs: number;
10
+ cpuSystemUs: number;
11
+ heapUsedBytes: number;
12
+ rssBytes: number;
13
+ };
14
+ export type AllocationCounterSource =
15
+ /**
16
+ * `v8.getHeapStatistics().total_allocated_bytes` (Node ≥ 26). Counts what the
17
+ * mutator allocated, collections included, but V8 advances it by whole
18
+ * allocation buffers, so a window is only exact to about a megabyte.
19
+ */
20
+ "v8-total-allocated"
21
+ /**
22
+ * Heap growth plus what each collection inside the window freed, from
23
+ * `v8.GCProfiler` (Node ≥ 18.15). Exact to the byte whatever the garbage.
24
+ */
25
+ | "gc-profiler"
26
+ /**
27
+ * Heap growth alone. Correct only while no collection runs in the window; a
28
+ * fallback, and one that says so through
29
+ * {@link AllocationCounter.undercounted}.
30
+ */
31
+ | "heap-growth"
32
+ /**
33
+ * `performance.memory.usedJSHeapSize` in Chromium; provided by the browser
34
+ * entry.
35
+ */
36
+ | "browser-heap-growth";
37
+ /**
38
+ * What a window's figure says about off-heap memory (typed array backing
39
+ * stores, buffers). No counter here sees a backing store allocated: they see
40
+ * the net movement of the process's external memory and what collections report
41
+ * freeing, and V8 can release one backing store while another is allocated, or
42
+ * after the collection reports. So no window's off-heap share is ever exact,
43
+ * and none is ever known to be zero:
44
+ *
45
+ * - `"lower-bound"`: external memory moved in the window; the figure includes
46
+ * that movement, and the bytes actually allocated off the heap may be more.
47
+ * - `"unknown"`: no movement was seen, which does not show that nothing was
48
+ * allocated off the heap — only that the net change stayed under 4 KiB.
49
+ */
50
+ export type OffHeapAccounting = "lower-bound" | "unknown";
51
+ export type AllocationCounter = {
52
+ readonly source: AllocationCounterSource;
53
+ /** Whether the last window may have lost bytes to a collection. */
54
+ readonly undercounted: boolean;
55
+ /**
56
+ * What the last window's figure says about off-heap memory; never that none
57
+ * was allocated. See {@link OffHeapAccounting}.
58
+ */
59
+ readonly offHeap: OffHeapAccounting;
60
+ /** Starts a window; one still open is discarded. */
61
+ begin(): void;
62
+ /**
63
+ * Bytes allocated since {@link AllocationCounter.begin}, minus the counter's
64
+ * own cost.
65
+ */
66
+ end(): number;
67
+ /** Discards an open window, for a batch that threw before `end`. */
68
+ abort(): void;
69
+ };
70
+ /**
71
+ * One reading source before calibration: reports the raw bytes of a window,
72
+ * counter bookkeeping included.
73
+ */
74
+ export type RawAllocationCounter = {
75
+ readonly source: AllocationCounterSource;
76
+ readonly undercounted: boolean;
77
+ readonly offHeap: OffHeapAccounting;
78
+ begin(): void;
79
+ end(): number;
80
+ abort(): void;
81
+ };
82
+ /**
83
+ * Wraps a raw counter so a window reports what the case allocated: the bytes
84
+ * the counter allocates itself are measured on empty windows and removed.
85
+ */
86
+ export declare function calibrateAllocationCounter(raw: RawAllocationCounter): AllocationCounter;
87
+ export declare function cpuTimeMs(before: ResourceCounters, after: ResourceCounters): number;
88
+ export type GcTotals = {
89
+ count: number;
90
+ pauseMs: number;
91
+ };
92
+ /** Running totals of observed collections; `read` is `null` when unobservable. */
93
+ export type GcReader = Disposable & {
94
+ read(): GcTotals | null;
95
+ };
96
+ export declare function gcSince(before: GcTotals | null, after: GcTotals | null): GcTotals | null;
97
+ //# sourceMappingURL=_allocation-counter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_allocation-counter.d.ts","sourceRoot":"","sources":["../src/_allocation-counter.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,yEAAyE;AACzE,MAAM,MAAM,gBAAgB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,uBAAuB;AAClC;;;;GAIG;AACD,oBAAoB;AACtB;;;GAGG;GACD,aAAa;AACf;;;;GAIG;GACD,aAAa;AACf;;;GAGG;GACD,qBAAqB,CAAC;AAEzB;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG,SAAS,CAAC;AAE1D,MAAM,MAAM,iBAAiB,GAAG;IAC/B,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC;IAEzC,mEAAmE;IACnE,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAE/B;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;IAEpC,oDAAoD;IACpD,KAAK,IAAI,IAAI,CAAC;IAEd;;;OAGG;IACH,GAAG,IAAI,MAAM,CAAC;IAEd,oEAAoE;IACpE,KAAK,IAAI,IAAI,CAAC;CACd,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAClC,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC;IACzC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;IACpC,KAAK,IAAI,IAAI,CAAC;IACd,GAAG,IAAI,MAAM,CAAC;IACd,KAAK,IAAI,IAAI,CAAC;CACd,CAAC;AAQF;;;GAGG;AACH,wBAAgB,0BAA0B,CACzC,GAAG,EAAE,oBAAoB,GACvB,iBAAiB,CA8BnB;AAED,wBAAgB,SAAS,CACxB,MAAM,EAAE,gBAAgB,EACxB,KAAK,EAAE,gBAAgB,GACrB,MAAM,CAOR;AAED,MAAM,MAAM,QAAQ,GAAG;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,kFAAkF;AAClF,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG;IACnC,IAAI,IAAI,QAAQ,GAAG,IAAI,CAAC;CACxB,CAAC;AAEF,wBAAgB,OAAO,CACtB,MAAM,EAAE,QAAQ,GAAG,IAAI,EACvB,KAAK,EAAE,QAAQ,GAAG,IAAI,GACpB,QAAQ,GAAG,IAAI,CASjB"}
@@ -0,0 +1,53 @@
1
+ import { median } from "@ac-kit/math-stats";
2
+ /** Empty windows run before the calibration is read, so the JIT has settled. */
3
+ const CALIBRATION_WARMUP_WINDOWS_ = 30;
4
+ /** Empty windows whose median is the counter's own cost. */
5
+ const CALIBRATION_WINDOWS_ = 31;
6
+ /**
7
+ * Wraps a raw counter so a window reports what the case allocated: the bytes
8
+ * the counter allocates itself are measured on empty windows and removed.
9
+ */
10
+ export function calibrateAllocationCounter(raw) {
11
+ for (let window = 0; window < CALIBRATION_WARMUP_WINDOWS_; window++) {
12
+ raw.begin();
13
+ raw.end();
14
+ }
15
+ const costs = [];
16
+ for (let window = 0; window < CALIBRATION_WINDOWS_; window++) {
17
+ raw.begin();
18
+ costs.push(raw.end());
19
+ }
20
+ // The median, because a collection that lands in a calibration window adds
21
+ // megabytes to that one reading.
22
+ const costBytes = median(costs);
23
+ return {
24
+ source: raw.source,
25
+ get undercounted() {
26
+ return raw.undercounted;
27
+ },
28
+ get offHeap() {
29
+ return raw.offHeap;
30
+ },
31
+ begin: () => raw.begin(),
32
+ abort: () => raw.abort(),
33
+ // Clamped: a window cannot allocate a negative amount, and a mean over
34
+ // batches would be meaningless with one.
35
+ end: () => Math.max(0, raw.end() - costBytes),
36
+ };
37
+ }
38
+ export function cpuTimeMs(before, after) {
39
+ return ((after.cpuUserUs -
40
+ before.cpuUserUs +
41
+ (after.cpuSystemUs - before.cpuSystemUs)) /
42
+ 1000);
43
+ }
44
+ export function gcSince(before, after) {
45
+ if (before === null || after === null) {
46
+ return null;
47
+ }
48
+ return {
49
+ count: after.count - before.count,
50
+ pauseMs: after.pauseMs - before.pauseMs,
51
+ };
52
+ }
53
+ //# sourceMappingURL=_allocation-counter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_allocation-counter.js","sourceRoot":"","sources":["../src/_allocation-counter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AA8F5C,gFAAgF;AAChF,MAAM,2BAA2B,GAAG,EAAE,CAAC;AAEvC,4DAA4D;AAC5D,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CACzC,GAAyB;IAEzB,KAAK,IAAI,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M,KAAK,IAAI,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACvC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,OAAO;QACN,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK;QACjC,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO;KACvC,CAAC;AACH,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { type AllocationCounter } from "./_allocation-counter.js";
2
+ import type { ResourceHost } from "./_host.js";
3
+ import type { ResourceBenchWarning } from "./_warnings.js";
4
+ /**
5
+ * Allocates a known structure through `counter` and compares, so a Chromium
6
+ * whose `performance.memory` is quantised (no `--enable-precise-memory-info`)
7
+ * or whose young generation was not enlarged does not report a plausible lie.
8
+ *
9
+ * @returns The warning, or `null` when the counter is within tolerance.
10
+ */
11
+ export declare function checkAllocationCounter(counter: AllocationCounter, expectedBytes?: number): ResourceBenchWarning | null;
12
+ /**
13
+ * Chromium's page counters: heap growth of `performance.memory` between two
14
+ * forced collections, with batches capped below a scavenge. CPU time, RSS and
15
+ * collection events are not readable from a page.
16
+ *
17
+ * @returns The host, or `null` outside Chromium (no `performance.memory`).
18
+ */
19
+ export declare function createChromiumResourceHost(): ResourceHost | null;
20
+ //# sourceMappingURL=_browser-host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_browser-host.d.ts","sourceRoot":"","sources":["../src/_browser-host.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,iBAAiB,EAKtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAmF3D;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACrC,OAAO,EAAE,iBAAiB,EAC1B,aAAa,GAAE,MAA8B,GAC3C,oBAAoB,GAAG,IAAI,CAoB7B;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,IAAI,YAAY,GAAG,IAAI,CA8ChE"}
@@ -0,0 +1,136 @@
1
+ import { calibrateAllocationCounter, } from "./_allocation-counter.js";
2
+ function readMemory_() {
3
+ return performance.memory;
4
+ }
5
+ /**
6
+ * Half the young generation the resource measure asks Chromium for
7
+ * (`--min-semi-space-size=64 --max-semi-space-size=64`, in MiB): a batch that
8
+ * allocates less never fills a semi-space, so no scavenge runs inside it.
9
+ */
10
+ const MAX_WINDOW_BYTES_ = 32 * 1024 * 1024;
11
+ /** Elements of the self-check: 100 000 triples of small integers. */
12
+ const PROBE_TRIPLES_ = 100000;
13
+ /** How far the self-check may miss before the counter is declared broken. */
14
+ const PROBE_TOLERANCE_ = 0.1;
15
+ /**
16
+ * Bytes V8 lays out for the self-check with pointer compression, as Chromium
17
+ * builds it on 64-bit hosts: the outer array's header (16) and backing store (8 +
18
+ * 4 per element), and per triple a `JSArray` header (16) and a `FixedArray` of
19
+ * three small integers (8 + 3 × 4).
20
+ */
21
+ const PROBE_EXPECTED_BYTES_ = 16 + 8 + 4 * PROBE_TRIPLES_ + PROBE_TRIPLES_ * (16 + 8 + 3 * 4);
22
+ function chromiumMemory_() {
23
+ const memory = readMemory_();
24
+ if (typeof memory?.usedJSHeapSize !== "number") {
25
+ return null;
26
+ }
27
+ return {
28
+ get usedJSHeapSize() {
29
+ return readMemory_().usedJSHeapSize;
30
+ },
31
+ get jsHeapSizeLimit() {
32
+ return readMemory_().jsHeapSizeLimit;
33
+ },
34
+ };
35
+ }
36
+ function collect_() {
37
+ globalThis.gc?.();
38
+ }
39
+ function createChromiumCounter_(memory) {
40
+ let heapStart = 0;
41
+ let undercounted = false;
42
+ return {
43
+ source: "browser-heap-growth",
44
+ get undercounted() {
45
+ return undercounted;
46
+ },
47
+ // `usedJSHeapSize` is the JS heap alone: backing stores are not in it.
48
+ offHeap: "unknown",
49
+ abort() { },
50
+ begin() {
51
+ undercounted = false;
52
+ heapStart = memory.usedJSHeapSize;
53
+ },
54
+ end() {
55
+ const growth = memory.usedJSHeapSize - heapStart;
56
+ undercounted = growth < 0;
57
+ return Math.max(0, growth);
58
+ },
59
+ };
60
+ }
61
+ /**
62
+ * Allocates a known structure through `counter` and compares, so a Chromium
63
+ * whose `performance.memory` is quantised (no `--enable-precise-memory-info`)
64
+ * or whose young generation was not enlarged does not report a plausible lie.
65
+ *
66
+ * @returns The warning, or `null` when the counter is within tolerance.
67
+ */
68
+ export function checkAllocationCounter(counter, expectedBytes = PROBE_EXPECTED_BYTES_) {
69
+ collect_();
70
+ counter.begin();
71
+ const outer = new Array(PROBE_TRIPLES_);
72
+ for (let index = 0; index < PROBE_TRIPLES_; index++) {
73
+ outer[index] = [index & 7, 1, 2];
74
+ }
75
+ const measured = counter.end();
76
+ // Read after `end`, so the structure stays alive through the window.
77
+ const kept = outer.length;
78
+ const error = Math.abs(measured - expectedBytes) / expectedBytes;
79
+ if (error <= PROBE_TOLERANCE_) {
80
+ return null;
81
+ }
82
+ return {
83
+ kind: "allocation-probe-failed",
84
+ message: `the allocation self-check measured ${measured} bytes for ${kept} triples where ${expectedBytes} were expected (${(error * 100).toFixed(0)}% off): run Chromium with --enable-precise-memory-info and the resource measure's V8 flags, or discard these allocation figures`,
85
+ };
86
+ }
87
+ /**
88
+ * Chromium's page counters: heap growth of `performance.memory` between two
89
+ * forced collections, with batches capped below a scavenge. CPU time, RSS and
90
+ * collection events are not readable from a page.
91
+ *
92
+ * @returns The host, or `null` outside Chromium (no `performance.memory`).
93
+ */
94
+ export function createChromiumResourceHost() {
95
+ const memory = chromiumMemory_();
96
+ if (memory === null) {
97
+ return null;
98
+ }
99
+ let counter = null;
100
+ let warnings = [];
101
+ const nullGc = {
102
+ read: () => null,
103
+ [Symbol.dispose]: () => { },
104
+ };
105
+ return {
106
+ readResourceCounters: () => ({
107
+ cpuUserUs: 0,
108
+ cpuSystemUs: 0,
109
+ heapUsedBytes: memory.usedJSHeapSize,
110
+ rssBytes: 0,
111
+ }),
112
+ readRssBytes: () => 0,
113
+ readHeapLimitBytes: () => memory.jsHeapSizeLimit,
114
+ selectAllocationCounter: () => {
115
+ if (counter === null) {
116
+ counter = calibrateAllocationCounter(createChromiumCounter_(memory));
117
+ const probe = checkAllocationCounter(counter);
118
+ warnings = [
119
+ {
120
+ kind: "cpu-time-unavailable",
121
+ message: "a page cannot read its CPU time: the CPU column is 0 and no CPU gate can be evaluated in this runtime",
122
+ },
123
+ ...(probe === null ? [] : [probe]),
124
+ ];
125
+ }
126
+ return counter;
127
+ },
128
+ hasExposedCollector: () => typeof globalThis.gc === "function",
129
+ forceCollection: collect_,
130
+ canObserveGc: () => false,
131
+ createGcRecorder: () => nullGc,
132
+ maxWindowBytes: MAX_WINDOW_BYTES_,
133
+ caseWarnings: () => warnings,
134
+ };
135
+ }
136
+ //# sourceMappingURL=_browser-host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_browser-host.js","sourceRoot":"","sources":["../src/_browser-host.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,0BAA0B,GAI1B,MAAM,0BAA0B,CAAC;AAclC,SAAS,WAAW;IACnB,OAAQ,WAA4C,CAAC,MAAM,CAAC;AAC7D,CAAC;AAED;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C,qEAAqE;AACrE,MAAM,cAAc,GAAG,MAAO,CAAC;AAE/B,6EAA6E;AAC7E,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,qBAAqB,GAC1B,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,cAAc,GAAG,cAAc,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAEjE,SAAS,eAAe;IACvB,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;IAC7B,IAAI,OAAO,MAAM,EAAE,cAAc,KAAK,QAAQ,EAAE,CAAC;QAChD,OAAO,IAAI,CAAC;IACb,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G,0BAA0B,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC,CAAC;gBACrE,MAAM,KAAK,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;gBAC9C,QAAQ,GAAG;oBACV;wBACC,IAAI,EAAE,sBAAsB;wBAC5B,OAAO,EACN,uGAAuG;qBACxG;oBACD,GAAG,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;iBAClC,CAAC;YACH,CAAC;YAED,OAAO,OAAO,CAAC;QAChB,CAAC;QACD,mBAAmB,EAAE,GAAG,EAAE,CACzB,OAAQ,UAA+B,CAAC,EAAE,KAAK,UAAU;QAC1D,eAAe,EAAE,QAAQ;QACzB,YAAY,EAAE,GAAG,EAAE,CAAC,KAAK;QACzB,gBAAgB,EAAE,GAAG,EAAE,CAAC,MAAM;QAC9B,cAAc,EAAE,iBAAiB;QACjC,YAAY,EAAE,GAAG,EAAE,CAAC,QAAQ;KAC5B,CAAC;AACH,CAAC"}
@@ -1,10 +1,6 @@
1
- /** One reading of the counters every resource figure is derived from. */
2
- export type ResourceCounters = {
3
- cpuUserUs: number;
4
- cpuSystemUs: number;
5
- heapUsedBytes: number;
6
- rssBytes: number;
7
- };
1
+ import { type AllocationCounter, type AllocationCounterSource, type GcReader, type GcTotals, type ResourceCounters } from "./_allocation-counter.js";
2
+ import type { ResourceHost } from "./_host.js";
3
+ export { type AllocationCounter, type AllocationCounterSource, cpuTimeMs, type GcTotals, gcSince, type OffHeapAccounting, type ResourceCounters, } from "./_allocation-counter.js";
8
4
  /**
9
5
  * Read twice per batch, so it allocates as little as the platform allows:
10
6
  * `v8.getHeapStatistics()` is deliberately not called here — it builds the
@@ -14,62 +10,6 @@ export type ResourceCounters = {
14
10
  export declare function readResourceCounters(): ResourceCounters;
15
11
  /** The heap ceiling this process was given, fixed for its lifetime. */
16
12
  export declare function readHeapLimitBytes(): number;
17
- export type AllocationCounterSource =
18
- /**
19
- * `v8.getHeapStatistics().total_allocated_bytes` (Node ≥ 26). Counts what the
20
- * mutator allocated, collections included, but V8 advances it by whole
21
- * allocation buffers, so a window is only exact to about a megabyte.
22
- */
23
- "v8-total-allocated"
24
- /**
25
- * Heap growth plus what each collection inside the window freed, from
26
- * `v8.GCProfiler` (Node ≥ 18.15). Exact to the byte whatever the garbage.
27
- */
28
- | "gc-profiler"
29
- /**
30
- * Heap growth alone. Correct only while no collection runs in the window; a
31
- * fallback, and one that says so through
32
- * {@link AllocationCounter.undercounted}.
33
- */
34
- | "heap-growth"
35
- /**
36
- * `performance.memory.usedJSHeapSize` in Chromium; provided by the browser
37
- * entry.
38
- */
39
- | "browser-heap-growth";
40
- /**
41
- * What a window's figure says about off-heap memory (typed array backing
42
- * stores, buffers). No counter here sees a backing store allocated: they see
43
- * the net movement of the process's external memory and what collections report
44
- * freeing, and V8 can release one backing store while another is allocated, or
45
- * after the collection reports. So no window's off-heap share is ever exact,
46
- * and none is ever known to be zero:
47
- *
48
- * - `"lower-bound"`: external memory moved in the window; the figure includes
49
- * that movement, and the bytes actually allocated off the heap may be more.
50
- * - `"unknown"`: no movement was seen, which does not show that nothing was
51
- * allocated off the heap — only that the net change stayed under 4 KiB.
52
- */
53
- export type OffHeapAccounting = "lower-bound" | "unknown";
54
- export type AllocationCounter = {
55
- readonly source: AllocationCounterSource;
56
- /** Whether the last window may have lost bytes to a collection. */
57
- readonly undercounted: boolean;
58
- /**
59
- * What the last window's figure says about off-heap memory; never that none
60
- * was allocated. See {@link OffHeapAccounting}.
61
- */
62
- readonly offHeap: OffHeapAccounting;
63
- /** Starts a window; one still open is discarded. */
64
- begin(): void;
65
- /**
66
- * Bytes allocated since {@link AllocationCounter.begin}, minus the counter's
67
- * own cost.
68
- */
69
- end(): number;
70
- /** Discards an open window, for a batch that threw before `end`. */
71
- abort(): void;
72
- };
73
13
  /**
74
14
  * The first of `sources` that works in this process, calibrated, or `null`.
75
15
  *
@@ -79,7 +19,6 @@ export type AllocationCounter = {
79
19
  */
80
20
  export declare function selectAllocationCounter(): AllocationCounter;
81
21
  export declare function selectAllocationCounter(sources: readonly AllocationCounterSource[]): AllocationCounter | null;
82
- export declare function cpuTimeMs(before: ResourceCounters, after: ResourceCounters): number;
83
22
  /** Whether the run was started with `--expose-gc`. */
84
23
  export declare function hasExposedCollector(): boolean;
85
24
  /**
@@ -90,10 +29,6 @@ export declare function hasExposedCollector(): boolean;
90
29
  * numbers are still comparable between cases in the same run.
91
30
  */
92
31
  export declare function forceCollection(): void;
93
- export type GcTotals = {
94
- count: number;
95
- pauseMs: number;
96
- };
97
32
  /**
98
33
  * Whether this runtime actually delivers `"gc"` performance entries.
99
34
  *
@@ -111,7 +46,7 @@ export declare function canObserveGc(): boolean;
111
46
  * observer must stay attached across every batch, and callers difference two
112
47
  * readings rather than restarting it.
113
48
  */
114
- export declare class GcRecorder {
49
+ export declare class GcRecorder implements GcReader {
115
50
  private readonly observer;
116
51
  private count_;
117
52
  private pauseMs_;
@@ -120,5 +55,6 @@ export declare class GcRecorder {
120
55
  [Symbol.dispose](): void;
121
56
  private absorb_;
122
57
  }
123
- export declare function gcSince(before: GcTotals | null, after: GcTotals | null): GcTotals | null;
58
+ /** What the Node entry installs: this process's own counters. */
59
+ export declare const NODE_RESOURCE_HOST: ResourceHost;
124
60
  //# sourceMappingURL=_counters.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"_counters.d.ts","sourceRoot":"","sources":["../src/_counters.ts"],"names":[],"mappings":"AAKA,yEAAyE;AACzE,MAAM,MAAM,gBAAgB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,gBAAgB,CAUvD;AAED,uEAAuE;AACvE,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,M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A6B;IACtD,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,QAAQ,CAAK;IAErB,YAAY,UAAU,EAAE,OAAO,EAU9B;IAED,IAAI,IAAI,QAAQ,GAAG,IAAI,CAWtB;IAED,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAEvB;IAED,OAAO,CAAC,OAAO;CAMf;AAED,iEAAiE;AACjE,eAAO,MAAM,kBAAkB,EAAE,YAWhC,CAAC"}
package/dist/_counters.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { PerformanceObserver } from "node:perf_hooks";
2
2
  import v8 from "node:v8";
3
- import { median } from "@ac-kit/math-stats";
3
+ import { calibrateAllocationCounter, } from "./_allocation-counter.js";
4
+ export { cpuTimeMs, gcSince, } from "./_allocation-counter.js";
4
5
  /**
5
6
  * Read twice per batch, so it allocates as little as the platform allows:
6
7
  * `v8.getHeapStatistics()` is deliberately not called here — it builds the
@@ -31,10 +32,6 @@ const ALLOCATION_SOURCE_ORDER_ = [
31
32
  "v8-total-allocated",
32
33
  "heap-growth",
33
34
  ];
34
- /** Empty windows run before the calibration is read, so the JIT has settled. */
35
- const CALIBRATION_WARMUP_WINDOWS_ = 30;
36
- /** Empty windows whose median is the counter's own cost. */
37
- const CALIBRATION_WINDOWS_ = 31;
38
35
  function createGcProfilerCounter_() {
39
36
  if (typeof v8.GCProfiler !== "function") {
40
37
  return null;
@@ -167,38 +164,6 @@ function createRawAllocationCounter_(source) {
167
164
  return null;
168
165
  }
169
166
  }
170
- /**
171
- * Wraps a raw counter so a window reports what the case allocated: the bytes
172
- * the counter allocates itself are measured on empty windows and removed.
173
- */
174
- function calibrate_(raw) {
175
- for (let window = 0; window < CALIBRATION_WARMUP_WINDOWS_; window++) {
176
- raw.begin();
177
- raw.end();
178
- }
179
- const costs = [];
180
- for (let window = 0; window < CALIBRATION_WINDOWS_; window++) {
181
- raw.begin();
182
- costs.push(raw.end());
183
- }
184
- // The median, because a collection that lands in a calibration window adds
185
- // megabytes to that one reading.
186
- const costBytes = median(costs);
187
- return {
188
- source: raw.source,
189
- get undercounted() {
190
- return raw.undercounted;
191
- },
192
- get offHeap() {
193
- return raw.offHeap;
194
- },
195
- begin: () => raw.begin(),
196
- abort: () => raw.abort(),
197
- // Clamped: a window cannot allocate a negative amount, and a mean over
198
- // batches would be meaningless with one.
199
- end: () => Math.max(0, raw.end() - costBytes),
200
- };
201
- }
202
167
  export function selectAllocationCounter(sources = ALLOCATION_SOURCE_ORDER_) {
203
168
  for (const source of sources) {
204
169
  const raw = createRawAllocationCounter_(source);
@@ -206,7 +171,7 @@ export function selectAllocationCounter(sources = ALLOCATION_SOURCE_ORDER_) {
206
171
  continue;
207
172
  }
208
173
  try {
209
- return calibrate_(raw);
174
+ return calibrateAllocationCounter(raw);
210
175
  }
211
176
  catch {
212
177
  continue;
@@ -214,12 +179,6 @@ export function selectAllocationCounter(sources = ALLOCATION_SOURCE_ORDER_) {
214
179
  }
215
180
  return null;
216
181
  }
217
- export function cpuTimeMs(before, after) {
218
- return ((after.cpuUserUs -
219
- before.cpuUserUs +
220
- (after.cpuSystemUs - before.cpuSystemUs)) /
221
- 1000);
222
- }
223
182
  /** Whether the run was started with `--expose-gc`. */
224
183
  export function hasExposedCollector() {
225
184
  return typeof globalThis.gc === "function";
@@ -298,13 +257,17 @@ export class GcRecorder {
298
257
  }
299
258
  }
300
259
  }
301
- export function gcSince(before, after) {
302
- if (before === null || after === null) {
303
- return null;
304
- }
305
- return {
306
- count: after.count - before.count,
307
- pauseMs: after.pauseMs - before.pauseMs,
308
- };
309
- }
260
+ /** What the Node entry installs: this process's own counters. */
261
+ export const NODE_RESOURCE_HOST = {
262
+ readResourceCounters,
263
+ readRssBytes: () => process.memoryUsage.rss(),
264
+ readHeapLimitBytes,
265
+ selectAllocationCounter: () => selectAllocationCounter(),
266
+ hasExposedCollector,
267
+ forceCollection,
268
+ canObserveGc,
269
+ createGcRecorder: (observable) => new GcRecorder(observable),
270
+ maxWindowBytes: null,
271
+ caseWarnings: () => [],
272
+ };
310
273
  //# sourceMappingURL=_counters.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_counters.js","sourceRoot":"","sources":["../src/_counters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAU5C;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB;IACnC,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC/B,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAErC,OAAO;QACN,SAAS,EAAE,GAAG,CAAC,IAAI;QACnB,WAAW,EAAE,GAAG,CAAC,MAAM;QACvB,aAAa,EAAE,MAAM,CAAC,QAAQ;QAC9B,QAAQ,EAAE,MAAM,CAAC,GAAG;KACpB,CAAC;AACH,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,kBAAkB;IACjC,OAAO,EAAE,CAAC,iBAAiB,EAAE,CAAC,eAAe,CAAC;AAC/C,CAAC;AA+ED,wEAAwE;AACxE,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC,SAAS,kBAAkB,CAAC,UAAkB;IAC7C,OAAO,UAAU,GAAG,qBAAqB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC;AACvE,CAAC;AAED,MAAM,wBAAwB,GAAuC;IACpE,aAAa;IACb,oBAAoB;IACpB,aAAa;CACb,CAAC;AAEF,gFAAgF;AAChF,MAAM,2BAA2B,GAAG,EAAE,CAAC;AAEvC,4DAA4D;AAC5D,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC,SAAS,wBAAwB;IAChC,IAAI,OAAO,EAAE,CAAC,UAAU,KAAK,UAAU,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,MAAM,QAAQ,GAAG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IAED,CAAC,MAAM,CAAC,OAAO,CAAC;QACf,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,CAAC;IAC7B,CAAC;IAEO,OAAO,CAAC,OAAoC;QACnD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;YACrD,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAE,CAAC,QAAQ,CAAC;QAC3C,CAAC;IACF,CAAC;CACD;AAED,iEAAiE;AACjE,MAAM,CAAC,MAAM,kBAAkB,GAAiB;IAC/C,oBAAoB;IACpB,YAAY,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE;IAC7C,kBAAkB;IAClB,uBAAuB,EAAE,GAAG,EAAE,CAAC,uBAAuB,EAAE;IACxD,mBAAmB;IACnB,eAAe;IACf,YAAY;IACZ,gBAAgB,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC;IAC5D,cAAc,EAAE,IAAI;IACpB,YAAY,EAAE,GAAG,EAAE,CAAC,EAAE;CACtB,CAAC"}
@@ -0,0 +1,40 @@
1
+ import type { AllocationCounter, GcReader, ResourceCounters } from "./_allocation-counter.js";
2
+ import type { ResourceBenchWarning } from "./_warnings.js";
3
+ /**
4
+ * What resource reads from the runtime it measures in. The Node entry installs
5
+ * the process's counters, the browser entry Chromium's page counters; the
6
+ * measuring code imports neither.
7
+ */
8
+ export type ResourceHost = {
9
+ /** Read twice per batch, outside the allocation window. */
10
+ readResourceCounters(): ResourceCounters;
11
+ /** Read once per iteration inside the window: must not allocate. */
12
+ readRssBytes(): number;
13
+ readHeapLimitBytes(): number;
14
+ /** Chosen and calibrated once per execution. */
15
+ selectAllocationCounter(): AllocationCounter;
16
+ hasExposedCollector(): boolean;
17
+ forceCollection(): void;
18
+ canObserveGc(): boolean;
19
+ createGcRecorder(observable: boolean): GcReader;
20
+ /**
21
+ * Bytes one window may allocate before a collection is likely inside it, for
22
+ * a counter that cannot see past one; `null`: no cap.
23
+ */
24
+ readonly maxWindowBytes: number | null;
25
+ /**
26
+ * What every case of this execution carries whatever its numbers: a failed
27
+ * allocation self-check, CPU time the runtime cannot read.
28
+ */
29
+ caseWarnings(): readonly ResourceBenchWarning[];
30
+ };
31
+ /** Called once by the entry that knows its runtime. */
32
+ export declare function installResourceHost(host: ResourceHost): void;
33
+ /**
34
+ * The installed host.
35
+ *
36
+ * @throws {UnsupportedInRuntimeError} No entry installed one: a runtime without
37
+ * allocation counters (Firefox, WebKit).
38
+ */
39
+ export declare function resourceHost(): ResourceHost;
40
+ //# sourceMappingURL=_host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_host.d.ts","sourceRoot":"","sources":["../src/_host.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACX,iBAAiB,EACjB,QAAQ,EACR,gBAAgB,EAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG;IAC1B,2DAA2D;IAC3D,oBAAoB,IAAI,gBAAgB,CAAC;IACzC,oEAAoE;IACpE,YAAY,IAAI,MAAM,CAAC;IACvB,kBAAkB,IAAI,MAAM,CAAC;IAC7B,gDAAgD;IAChD,uBAAuB,IAAI,iBAAiB,CAAC;IAC7C,mBAAmB,IAAI,OAAO,CAAC;IAC/B,eAAe,IAAI,IAAI,CAAC;IACxB,YAAY,IAAI,OAAO,CAAC;IACxB,gBAAgB,CAAC,UAAU,EAAE,OAAO,GAAG,QAAQ,CAAC;IAChD;;;OAGG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC;;;OAGG;IACH,YAAY,IAAI,SAAS,oBAAoB,EAAE,CAAC;CAChD,CAAC;AAIF,uDAAuD;AACvD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,YAAY,CAM3C"}
package/dist/_host.js ADDED
@@ -0,0 +1,19 @@
1
+ import { UnsupportedInRuntimeError } from "@ac-bench/core/runner";
2
+ let installed_ = null;
3
+ /** Called once by the entry that knows its runtime. */
4
+ export function installResourceHost(host) {
5
+ installed_ = host;
6
+ }
7
+ /**
8
+ * The installed host.
9
+ *
10
+ * @throws {UnsupportedInRuntimeError} No entry installed one: a runtime without
11
+ * allocation counters (Firefox, WebKit).
12
+ */
13
+ export function resourceHost() {
14
+ if (installed_ === null) {
15
+ throw new UnsupportedInRuntimeError("allocation counters");
16
+ }
17
+ return installed_;
18
+ }
19
+ //# sourceMappingURL=_host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_host.js","sourceRoot":"","sources":["../src/_host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAsClE,IAAI,UAAU,GAAwB,IAAI,CAAC;AAE3C,uDAAuD;AACvD,MAAM,UAAU,mBAAmB,CAAC,IAAkB;IACrD,UAAU,GAAG,IAAI,CAAC;AACnB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY;IAC3B,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;QACzB,MAAM,IAAI,yBAAyB,CAAC,qBAAqB,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { BenchCaseRunContext } from "@ac-bench/core/runner";
2
2
  import { MaybeAsyncCallable } from "@ac-kit/core";
3
- import { AllocationCounter } from "./_counters.js";
3
+ import { AllocationCounter } from "./_allocation-counter.js";
4
4
  import { ResourceCaseOptions, ResourceConditionOptions } from "./options.js";
5
5
  export type ResourceCaseFn = MaybeAsyncCallable<[signal: AbortSignal]>;
6
6
  export type RunResourceCaseOptions = ResourceCaseOptions & {
@@ -1 +1 @@
1
- {"version":3,"file":"_run-case.d.ts","sourceRoot":"","sources":["../src/_run-case.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,mBAAmB,EAMnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAwB,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAExE,OAAO,EACN,iBAAiB,EAUjB,MAAM,gBAAgB,CAAC;AAIxB,OAAO,EAEN,mBAAmB,EACnB,wBAAwB,EAExB,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,cAAc,GAAG,kBAAkB,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;AAEvE,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,GAAG;IAC1D,gBAAgB,CAAC,EAAE,wBAAwB,CAAC;IAE5C,uEAAuE;IACvE,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IAEtC,gEAAgE;IAChE,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAsFF,wBAAsB,eAAe,CACpC,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,cAAc,EAClB,OAAO,EAAE,mBAAmB,EAC5B,OAAO,CAAC,EAAE,sBAAsB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAqHf"}
1
+ {"version":3,"file":"_run-case.d.ts","sourceRoot":"","sources":["../src/_run-case.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,mBAAmB,EAOnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAwB,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAExE,OAAO,EACN,iBAAiB,EAIjB,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EAEN,mBAAmB,EACnB,wBAAwB,EAExB,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,cAAc,GAAG,kBAAkB,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;AAEvE,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,GAAG;IAC1D,gBAAgB,CAAC,EAAE,wBAAwB,CAAC;IAE5C,uEAAuE;IACvE,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IAEtC,gEAAgE;IAChE,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAwFF,wBAAsB,eAAe,CACpC,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,cAAc,EAClB,OAAO,EAAE,mBAAmB,EAC5B,OAAO,CAAC,EAAE,sBAAsB,GAC9B,OAAO,CAAC,IAAI,CAAC,CA4If"}
package/dist/_run-case.js CHANGED
@@ -50,16 +50,17 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
50
50
  var e = new Error(message);
51
51
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
52
52
  });
53
- import { allOfPolicies, createProjectedPolicy, createRelativeErrorPolicy, createStabilityPolicy, reportCaseFailure, Sampler, } from "@ac-bench/core/runner";
53
+ import { allOfPolicies, createProjectedPolicy, createRelativeErrorPolicy, createStabilityPolicy, reportCaseFailure, runSamplingDefaults, Sampler, } from "@ac-bench/core/runner";
54
54
  import { defaults, isThenable } from "@ac-kit/core";
55
- import { canObserveGc, cpuTimeMs, forceCollection, GcRecorder, gcSince, hasExposedCollector, readHeapLimitBytes, readResourceCounters, selectAllocationCounter, } from "./_counters.js";
55
+ import { cpuTimeMs, gcSince, } from "./_allocation-counter.js";
56
+ import { resourceHost } from "./_host.js";
56
57
  import { composeResourceBenchStatistics } from "./_statistics.js";
57
58
  import { detectResourceBenchWarnings } from "./_warnings.js";
58
59
  import { RESOURCE_SAMPLING_DEFAULTS, } from "./options.js";
59
60
  /** Chosen and calibrated once, because both cost a few milliseconds. */
60
61
  let processCounter_;
61
- function processAllocationCounter_() {
62
- processCounter_ ??= selectAllocationCounter();
62
+ function processAllocationCounter_(host) {
63
+ processCounter_ ??= host.selectAllocationCounter();
63
64
  return processCounter_;
64
65
  }
65
66
  /**
@@ -75,9 +76,9 @@ function processAllocationCounter_() {
75
76
  * it establishes the floor the growth is measured from, and its own cost is not
76
77
  * part of what the case allocated.
77
78
  */
78
- async function measureBatch_(fn, iterations, gc, counter, signal) {
79
- forceCollection();
80
- const before = readResourceCounters();
79
+ async function measureBatch_(host, fn, iterations, gc, counter, signal) {
80
+ host.forceCollection();
81
+ const before = host.readResourceCounters();
81
82
  const gcBefore = gc.read();
82
83
  let rssPeakBytes = before.rssBytes;
83
84
  counter.begin();
@@ -91,7 +92,7 @@ async function measureBatch_(fn, iterations, gc, counter, signal) {
91
92
  if (isThenable(returned)) {
92
93
  await returned;
93
94
  }
94
- const rss = process.memoryUsage.rss();
95
+ const rss = host.readRssBytes();
95
96
  if (rss > rssPeakBytes) {
96
97
  rssPeakBytes = rss;
97
98
  }
@@ -104,7 +105,7 @@ async function measureBatch_(fn, iterations, gc, counter, signal) {
104
105
  throw error;
105
106
  }
106
107
  const allocated = counter.end();
107
- const after = readResourceCounters();
108
+ const after = host.readResourceCounters();
108
109
  const gcDelta = gcSince(gcBefore, gc.read());
109
110
  return {
110
111
  operations: iterations,
@@ -116,26 +117,31 @@ async function measureBatch_(fn, iterations, gc, counter, signal) {
116
117
  gcPauseMs: gcDelta === null ? null : gcDelta.pauseMs / iterations,
117
118
  // Heap growth cannot see what a collection freed. Without a way to see
118
119
  // collections either, no window is known to be clean.
119
- undercounted: counter.source === "heap-growth" &&
120
- (counter.undercounted || gcDelta === null || gcDelta.count > 0),
120
+ undercounted: counter.source === "heap-growth"
121
+ ? counter.undercounted || gcDelta === null || gcDelta.count > 0
122
+ : counter.undercounted,
121
123
  offHeap: counter.offHeap,
122
124
  };
123
125
  }
124
126
  export async function runResourceCase(title, fn, context, options) {
125
127
  const { signal } = context;
126
128
  signal.throwIfAborted();
127
- const sampling = defaults(options?.conditionOptions?.sampling ?? {}, RESOURCE_SAMPLING_DEFAULTS);
129
+ const sampling = defaults({
130
+ ...runSamplingDefaults(context),
131
+ ...options?.conditionOptions?.sampling,
132
+ }, RESOURCE_SAMPLING_DEFAULTS);
128
133
  const tags = options?.tags ?? {};
129
- const forcedCollection = hasExposedCollector();
134
+ const host = resourceHost();
135
+ const forcedCollection = host.hasExposedCollector();
130
136
  const samples = [];
131
- const heapLimitBytes = readHeapLimitBytes();
137
+ const heapLimitBytes = host.readHeapLimitBytes();
132
138
  let counter = null;
133
139
  try {
134
140
  const env_1 = { stack: [], error: void 0, hasError: false };
135
141
  try {
136
142
  await options?.setup?.(signal);
137
- counter = options?.allocationCounter ?? processAllocationCounter_();
138
- const gc = __addDisposableResource(env_1, new GcRecorder(options?.observeCollections ?? canObserveGc()), false);
143
+ counter = options?.allocationCounter ?? processAllocationCounter_(host);
144
+ const gc = __addDisposableResource(env_1, host.createGcRecorder(options?.observeCollections ?? host.canObserveGc()), false);
139
145
  for (let iteration = 0; iteration < sampling.warmup; iteration++) {
140
146
  signal.throwIfAborted();
141
147
  await fn(signal);
@@ -160,21 +166,29 @@ export async function runResourceCase(title, fn, context, options) {
160
166
  signal,
161
167
  // One sample is one batch, and the sampler sizes the next batch in
162
168
  // iterations — so this is the cost of one operation, not of the batch
163
- // the sample came from.
164
- costOf: (sample) => sample.cpuTimeMs,
169
+ // the sample came from. A runtime without CPU time sizes by wall time.
170
+ costOf: (sample) => sample.cpuTimeMs > 0 ? sample.cpuTimeMs : wallPerOperationMs,
165
171
  targetBatchMs: sampling.targetBatchMs,
166
172
  });
167
173
  let cap = Number.POSITIVE_INFINITY;
174
+ let wallPerOperationMs = 0;
168
175
  for (let size = sampler.nextBatch(); size !== null; size = sampler.nextBatch()) {
169
176
  const startedAt = performance.now();
170
- const sample = await measureBatch_(fn, Math.min(size, cap), gc, counter, signal);
177
+ const sample = await measureBatch_(host, fn, Math.min(size, cap), gc, counter, signal);
171
178
  // A collection hid bytes from this counter; a smaller batch is less
172
179
  // likely to contain one.
173
180
  if (sample.undercounted) {
174
181
  cap = Math.max(1, Math.floor(Math.min(size, cap) / 2));
175
182
  }
183
+ // A counter blind to collections keeps each batch's garbage below what
184
+ // would trigger one.
185
+ if (host.maxWindowBytes !== null && sample.allocatedBytes > 0) {
186
+ cap = Math.min(cap, Math.max(1, Math.floor(host.maxWindowBytes / sample.allocatedBytes)));
187
+ }
176
188
  samples.push(sample);
177
- sampler.observe([sample], performance.now() - startedAt);
189
+ const wallMs = performance.now() - startedAt;
190
+ wallPerOperationMs = wallMs / sample.operations;
191
+ sampler.observe([sample], wallMs);
178
192
  context.progress(samples.length);
179
193
  }
180
194
  }
@@ -209,7 +223,10 @@ export async function runResourceCase(title, fn, context, options) {
209
223
  statistics,
210
224
  forcedCollection,
211
225
  allocationSource: counter.source,
212
- warnings: detectResourceBenchWarnings(statistics, forcedCollection),
226
+ warnings: [
227
+ ...host.caseWarnings(),
228
+ ...detectResourceBenchWarnings(statistics, forcedCollection),
229
+ ],
213
230
  });
214
231
  }
215
232
  //# sourceMappingURL=_run-case.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_run-case.js","sourceRoot":"","sources":["../src/_run-case.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EACN,aAAa,EAEb,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACrB,iBAAiB,EACjB,OAAO,GACP,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAsB,MAAM,cAAc,CAAC;AAExE,OAAO,EAEN,YAAY,EACZ,SAAS,EACT,eAAe,EACf,UAAU,EACV,OAAO,EACP,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,GACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAC;AAElE,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EACN,0BAA0B,GAI1B,MAAM,cAAc,CAAC;AActB,wEAAwE;AACxE,IAAI,eAA8C,C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A2B,CAAC,UAAU,EAAE,gBAAgB,CAAC;SAC5D;KACoC,CAAC,CAAC;AACzC,CAAC"}
package/dist/_types.d.ts CHANGED
@@ -90,8 +90,10 @@ export declare const resourceBenchRunCaseResultSchema: z.ZodMiniObject<{
90
90
  }>>;
91
91
  warnings: z.ZodMiniArray<z.ZodMiniObject<{
92
92
  kind: z.ZodMiniEnum<{
93
+ "allocation-probe-failed": "allocation-probe-failed";
93
94
  "allocation-undercounted": "allocation-undercounted";
94
95
  "below-resolution": "below-resolution";
96
+ "cpu-time-unavailable": "cpu-time-unavailable";
95
97
  "gc-bound": "gc-bound";
96
98
  "heap-pressure": "heap-pressure";
97
99
  "no-forced-collection": "no-forced-collection";
@@ -139,8 +141,10 @@ export declare const resourceBenchRunConditionResultSchema: z.ZodMiniObject<{
139
141
  }>>;
140
142
  warnings: z.ZodMiniArray<z.ZodMiniObject<{
141
143
  kind: z.ZodMiniEnum<{
144
+ "allocation-probe-failed": "allocation-probe-failed";
142
145
  "allocation-undercounted": "allocation-undercounted";
143
146
  "below-resolution": "below-resolution";
147
+ "cpu-time-unavailable": "cpu-time-unavailable";
144
148
  "gc-bound": "gc-bound";
145
149
  "heap-pressure": "heap-pressure";
146
150
  "no-forced-collection": "no-forced-collection";
@@ -1 +1 @@
1
- {"version":3,"file":"_types.d.ts","sourceRoot":"","sources":["../src/_types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAI9B,eAAO,MAAM,6BAA6B;;;;;EAKxC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;;EAAqC,CAAC;AAE1E;;;GAGG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;iBAmBpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,QAAA,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;iBA6CjC,CAAC;AACH,MA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AACH,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CACpD,OAAO,qCAAqC,CAC5C,CAAC"}
@@ -1,8 +1,10 @@
1
1
  import * as z from "zod/mini";
2
2
  import { ResourceBenchStatistics } from "./_types.js";
3
3
  export declare const resourceBenchWarningKindSchema: z.ZodMiniEnum<{
4
+ "allocation-probe-failed": "allocation-probe-failed";
4
5
  "allocation-undercounted": "allocation-undercounted";
5
6
  "below-resolution": "below-resolution";
7
+ "cpu-time-unavailable": "cpu-time-unavailable";
6
8
  "gc-bound": "gc-bound";
7
9
  "heap-pressure": "heap-pressure";
8
10
  "no-forced-collection": "no-forced-collection";
@@ -12,8 +14,10 @@ export declare const resourceBenchWarningKindSchema: z.ZodMiniEnum<{
12
14
  export type ResourceBenchWarningKind = z.infer<typeof resourceBenchWarningKindSchema>;
13
15
  export declare const resourceBenchWarningSchema: z.ZodMiniObject<{
14
16
  kind: z.ZodMiniEnum<{
17
+ "allocation-probe-failed": "allocation-probe-failed";
15
18
  "allocation-undercounted": "allocation-undercounted";
16
19
  "below-resolution": "below-resolution";
20
+ "cpu-time-unavailable": "cpu-time-unavailable";
17
21
  "gc-bound": "gc-bound";
18
22
  "heap-pressure": "heap-pressure";
19
23
  "no-forced-collection": "no-forced-collection";
@@ -1 +1 @@
1
- {"version":3,"file":"_warnings.d.ts","sourceRoot":"","sources":["../src/_warnings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAWtD,eAAO,MAAM,8BAA8B;;;;;;;;EAQzC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,8BAA8B,CACrC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;iBAGrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,wBAAgB,2BAA2B,CAC1C,UAAU,EAAE,uBAAuB,EACnC,gBAAgB,EAAE,OAAO,GACvB,oBAAoB,EAAE,CA0DxB"}
1
+ {"version":3,"file":"_warnings.d.ts","sourceRoot":"","sources":["../src/_warnings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAWtD,eAAO,MAAM,8BAA8B;;;;;;;;;;EAUzC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,8BAA8B,CACrC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;iBAGrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,wBAAgB,2BAA2B,CAC1C,UAAU,EAAE,uBAAuB,EACnC,gBAAgB,EAAE,OAAO,GACvB,oBAAoB,EAAE,CA0DxB"}
package/dist/_warnings.js CHANGED
@@ -13,6 +13,8 @@ export const resourceBenchWarningKindSchema = z.enum([
13
13
  "too-few-samples",
14
14
  "allocation-undercounted",
15
15
  "off-heap-lower-bound",
16
+ "allocation-probe-failed",
17
+ "cpu-time-unavailable",
16
18
  ]);
17
19
  export const resourceBenchWarningSchema = z.object({
18
20
  kind: resourceBenchWarningKindSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"_warnings.js","sourceRoot":"","sources":["../src/_warnings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAI9B,oEAAoE;AACpE,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAEjC,2EAA2E;AAC3E,MAAM,eAAe,GAAG,IAAI,CAAC;AAE7B,iFAAiF;AACjF,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAEvC,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAA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,CAAC;IAED,IAAI,UAAU,CAAC,cAAc,GAAG,CAAC,EAAE,CAAC;QACnC,QAAQ,CAAC,IAAI,CAAC;YACb,IAAI,EAAE,sBAAsB;YAC5B,OAAO,EAAE,GAAG,UAAU,CAAC,cAAc,OAAO,UAAU,CAAC,OAAO,qMAAqM;SACnQ,CAAC,CAAC;IACJ,CAAC;IAED,IAAI,UAAU,CAAC,cAAc,GAAG,4BAA4B,EAAE,CAAC;QAC9D,QAAQ,CAAC,IAAI,CAAC;YACb,IAAI,EAAE,kBAAkB;YACxB,OAAO,EACN,2FAA2F;SAC5F,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,QAAQ,CAAC;AACjB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { afterAll, afterEach, beforeAll, beforeEach, boundGate, differenceGate, ratioGate, registerGate, } from "@ac-bench/core/runner";
2
+ export * from "./decl.js";
3
+ export * from "./options.js";
4
+ //# sourceMappingURL=index.browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":"AAUA,OAAO,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,cAAc,EACd,SAAS,EACT,YAAY,GACZ,MAAM,uBAAuB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The portable entry, selected by the `"browser"` export condition: the same
3
+ * registration API as the Node entry, measuring through Chromium's page
4
+ * counters where `performance.memory` exists; elsewhere a case fails alone with
5
+ * `unsupported-in-runtime` (the parent skips those runtimes first, through the
6
+ * plugin's `supportsRuntime`).
7
+ */
8
+ import { createChromiumResourceHost } from "./_browser-host.js";
9
+ import { installResourceHost } from "./_host.js";
10
+ export { afterAll, afterEach, beforeAll, beforeEach, boundGate, differenceGate, ratioGate, registerGate, } from "@ac-bench/core/runner";
11
+ export * from "./decl.js";
12
+ export * from "./options.js";
13
+ const host = createChromiumResourceHost();
14
+ if (host !== null) {
15
+ installResourceHost(host);
16
+ }
17
+ //# sourceMappingURL=index.browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.browser.js","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,cAAc,EACd,SAAS,EACT,YAAY,GACZ,MAAM,uBAAuB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAE7B,MAAM,IAAI,GAAG,0BAA0B,EAAE,CAAC;AAC1C,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;IACnB,mBAAmB,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,cAAc,EACd,SAAS,EACT,YAAY,GACZ,MAAM,uBAAuB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,cAAc,EACd,SAAS,EACT,YAAY,GACZ,MAAM,uBAAuB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,7 @@
1
+ import { NODE_RESOURCE_HOST } from "./_counters.js";
2
+ import { installResourceHost } from "./_host.js";
1
3
  export { afterAll, afterEach, beforeAll, beforeEach, boundGate, differenceGate, ratioGate, registerGate, } from "@ac-bench/core/runner";
2
4
  export * from "./decl.js";
3
5
  export * from "./options.js";
6
+ installResourceHost(NODE_RESOURCE_HOST);
4
7
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,cAAc,EACd,SAAS,EACT,YAAY,GACZ,MAAM,uBAAuB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,cAAc,EACd,SAAS,EACT,YAAY,GACZ,MAAM,uBAAuB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAE7B,mBAAmB,CAAC,kBAAkB,CAAC,CAAC"}
package/dist/plugin.js CHANGED
@@ -140,7 +140,22 @@ export default defineMeasurePlugin({
140
140
  rounds: "one",
141
141
  grouping: "case",
142
142
  execArgv: ["--expose-gc"],
143
+ // Exact heap figures, a collector to call, and a young generation large
144
+ // enough that a capped batch never triggers a scavenge (§4.3.8).
145
+ browser: {
146
+ chromiumArgs: ["--enable-precise-memory-info"],
147
+ v8Flags: [
148
+ "--expose-gc",
149
+ "--min-semi-space-size=64",
150
+ "--max-semi-space-size=64",
151
+ ],
152
+ },
143
153
  },
154
+ // Node, and Chromium through its page counters; no other engine exposes a
155
+ // heap figure to a page.
156
+ supportsRuntime: (runtime) => runtime.kind === "node" ||
157
+ runtime.engine === "v8" ||
158
+ `${runtime.product} exposes no heap counter to a page`,
144
159
  gateMetrics: resourceGateMetrics,
145
160
  // Each execution measured its own process's heap. Pooling them would average
146
161
  // two heaps that never coexisted, so the first is reported as it stands.
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,mBAAmB,EACnB,4BAA4B,GAC5B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAKzD,OAAO,EACN,gCAAgC,EAChC,qCAAqC,GACrC,MAAM,aAAa,CAAC;AAErB,MAAM,UAAU,GAAG,UAAU,CAAC;AAE9B,SAAS,gBAAgB,CAAC,KAAc;IACvC,MAAM,MAAM,GAAG,gCAAgC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACjE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACrB,MAAM,IAAI,4BAA4B,CACrC,UAAU,EACV,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAC7B,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACpB,CAAC;AAED,SAAS,qBAAqB,CAC7B,KAAc;IAEd,MAAM,MAAM,GAAG,qCAAqC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACtE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACrB,MAAM,IAAI,4BAA4B,CACrC,UAAU,EACV,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAC7B,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACpB,CAAC;AAED,MAAM,WAAW,GAAG,EAAE,qBAAqB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AAM;QAChB,QAAQ,EAAE,CAAC,aAAa,CAAC;QACzB,wEAAwE;QACxE,iEAAiE;QACjE,OAAO,EAAE;YACR,YAAY,EAAE,CAAC,8BAA8B,CAAC;YAC9C,OAAO,EAAE;gBACR,aAAa;gBACb,0BAA0B;gBAC1B,0BAA0B;aAC1B;SACD;KACD;IAED,0EAA0E;IAC1E,yBAAyB;IACzB,eAAe,EAAE,CAAC,OAAO,EAAE,EAAE,CAC5B,OAAO,CAAC,IAAI,KAAK,MAAM;QACvB,OAAO,CAAC,MAAM,KAAK,IAAI;QACvB,GAAG,OAAO,CAAC,OAAO,oCAAoC;IAEvD,WAAW,EAAE,mBAAmB;IAEhC,6EAA6E;IAC7E,yEAAyE;IACzE,IAAI,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAE,CAAC,MAAM;IAE3C,UAAU,EAAE,CAAC,MAAM,EAAW,EAAE,CAAC,MAAM;IAEvC,eAAe,EAAE,CAAC,MAAM,EAAW,EAAE,CAAC,CAAC;QACtC,kBAAkB,EAAE,CAAC,EAAE,IAAI,EAAE,UAAmB,EAAE,GAAG,MAAM,EAAE,CAAC;KAC9D,CAAC;CACF,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ac-bench/measure-resource",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Resource measure for @ac-bench: CPU time, peak heap, bytes allocated, and garbage-collection count and pause time.",
5
5
  "keywords": [
6
6
  "allocation",
@@ -9,7 +9,7 @@
9
9
  "gc",
10
10
  "memory"
11
11
  ],
12
- "homepage": "https://git.grenadine.io/anthochamp/node-essentials/src/branch/main/bench/measure-resource#readme",
12
+ "homepage": "https://anthochamp.pages.grenadine.io/node-essentials/bench/",
13
13
  "bugs": {
14
14
  "url": "https://git.grenadine.io/anthochamp/node-essentials/issues"
15
15
  },
@@ -24,16 +24,27 @@
24
24
  "dist"
25
25
  ],
26
26
  "type": "module",
27
- "sideEffects": false,
27
+ "sideEffects": [
28
+ "./src/index.ts",
29
+ "./src/index.browser.ts",
30
+ "./dist/index.js",
31
+ "./dist/index.browser.js"
32
+ ],
28
33
  "main": "./dist/index.js",
29
34
  "exports": {
30
- ".": "./dist/index.js",
35
+ ".": {
36
+ "browser": "./dist/index.browser.js",
37
+ "default": "./dist/index.js"
38
+ },
31
39
  "./plugin": "./dist/plugin.js"
32
40
  },
33
41
  "publishConfig": {
34
42
  "main": "./dist/index.js",
35
43
  "exports": {
36
- ".": "./dist/index.js",
44
+ ".": {
45
+ "browser": "./dist/index.browser.js",
46
+ "default": "./dist/index.js"
47
+ },
37
48
  "./plugin": "./dist/plugin.js"
38
49
  },
39
50
  "access": "public"
@@ -47,18 +58,18 @@
47
58
  "prepack": "yarn build"
48
59
  },
49
60
  "dependencies": {
50
- "@ac-bench/core": "^0.4.0",
51
- "@ac-kit/algo": "^0.6.0",
52
- "@ac-kit/app-report": "^0.3.1",
53
- "@ac-kit/core": "^0.13.0",
54
- "@ac-kit/math-stats": "^0.6.0",
55
- "@ac-kit/model-dataset": "^0.3.0",
61
+ "@ac-bench/core": "^0.5.0",
62
+ "@ac-kit/algo": "^0.7.0",
63
+ "@ac-kit/app-report": "^0.4.0",
64
+ "@ac-kit/core": "^0.14.0",
65
+ "@ac-kit/math-stats": "^0.7.0",
66
+ "@ac-kit/model-dataset": "^0.3.1",
56
67
  "zod": "^4.5.4"
57
68
  },
58
69
  "devDependencies": {
59
70
  "@ac-kit/tsconfig": "0.1.0",
60
71
  "@ac-kit/typedoc-config": "0.1.0",
61
- "@ac-kit/vitest-config": "0.2.0",
72
+ "@ac-kit/vitest-config": "0.3.0",
62
73
  "@types/node": "26.6.11",
63
74
  "@typescript/native": "typescript@7.0.2",
64
75
  "rimraf": "6.1.4",