@ac-bench/measure-constant-time 0.1.11 → 0.2.1

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,124 @@
1
1
  # @ac-bench/measure-constant-time
2
2
 
3
+ ## 0.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [0b4fe43]
8
+ - Updated dependencies [0b4fe43]
9
+ - Updated dependencies [0b4fe43]
10
+ - Updated dependencies [0b4fe43]
11
+ - Updated dependencies [0b4fe43]
12
+ - Updated dependencies [0b4fe43]
13
+ - Updated dependencies [0b4fe43]
14
+ - Updated dependencies [0b4fe43]
15
+ - Updated dependencies [0b4fe43]
16
+ - Updated dependencies [0b4fe43]
17
+ - Updated dependencies [0b4fe43]
18
+ - Updated dependencies [0b4fe43]
19
+ - Updated dependencies [0b4fe43]
20
+ - Updated dependencies [0b4fe43]
21
+ - Updated dependencies [0b4fe43]
22
+ - Updated dependencies [0b4fe43]
23
+ - Updated dependencies [0b4fe43]
24
+ - Updated dependencies [0b4fe43]
25
+ - Updated dependencies [0b4fe43]
26
+ - Updated dependencies [0b4fe43]
27
+ - Updated dependencies [0b4fe43]
28
+ - Updated dependencies [0b4fe43]
29
+ - Updated dependencies [0b4fe43]
30
+ - Updated dependencies [0b4fe43]
31
+ - Updated dependencies [0b4fe43]
32
+ - @ac-kit/algo@0.6.0
33
+ - @ac-bench/core@0.4.0
34
+ - @ac-kit/core@0.13.0
35
+ - @ac-kit/math-stats@0.6.0
36
+ - @ac-kit/model-dataset@0.3.0
37
+ - @ac-kit/app-report@0.3.1
38
+ - @ac-kit/math-random@0.4.1
39
+
40
+ ## 0.2.0
41
+
42
+ ### Minor Changes
43
+
44
+ - 34e8cfa: Reports tell conditions apart. **`@ac-bench/reporter-json`** writes the archive
45
+ (`format: "ac-bench-archive"`, version 1) instead of one section per measure:
46
+ every condition keyed and titled, so two suites that each declare a case `new`
47
+ are two conditions, with the run, machine and runtime descriptions, and what a
48
+ gate reads: each execution's `processKey` and `observations` per gate metric,
49
+ each condition's `metrics`, the run's `gates` and `verdicts`, so
50
+ `@ac-bench/gate` evaluates it offline. It folds
51
+ events as they arrive and keeps no raw result, and writes nothing for a run that
52
+ described nothing (a listing). **Migration:** read `conditions[].cases[].result`
53
+ where you read `<measure>.conditions[]`. **`@ac-bench/reporter-markdown`** opens
54
+ with an environment section and renders one titled table per condition, its
55
+ heading on one line whatever the titles or file name hold.
56
+ **`@ac-bench/reporter-csv`** writes one table per condition, each row ending with
57
+ `runtime` and `condition` columns; a condition with no result is one row with
58
+ only those two filled. Neither asks a measure to conclude on a condition with
59
+ no result. **`@ac-bench/measure-duration`** leaves the
60
+ raw `timings` out of its JSON form unless the run was started with
61
+ `--emit-samples`; a six-case archive no longer weighs tens of megabytes.
62
+ **Duration, jitter, resource and constant-time** close a case that threw as
63
+ `failed` — its failure result is still reported — so the archive, the report
64
+ and the run's outcome count it as failed rather than measured.
65
+ - 34e8cfa: Gates. Every measure package re-exports `ratioGate`, `differenceGate`,
66
+ `boundGate` and `registerGate` beside `beforeAll` and `afterAll`, so a suite
67
+ declares a gate next to the cases it reads. `@ac-bench/measure-duration` declares
68
+ the gate metrics `median` (the default) and `mean`, per operation on the log
69
+ scale: the variance of the median comes from its distribution-free interval,
70
+ never below what the clock's quantum forces over the timed span. A gate reads
71
+ `statistics`, not the overhead-adjusted ones. `@ac-bench/measure-resource`
72
+ declares `allocatedBytes` (linear, in bytes per operation, never more precise
73
+ than one byte over a batch) and `cpuTime` (log); its statistics gain
74
+ `allocatedBytesMad` and `cpuTimeMsMad`, the median absolute deviation of the
75
+ per-batch costs the medians summarise, and `allocatedBytesMedianVariance` and
76
+ `cpuTimeMsMedianVariance`, each median's exact bootstrap variance, which the
77
+ gate metrics read as the median's uncertainty. Measures without gate metrics
78
+ cannot be gated.
79
+
80
+ ### Patch Changes
81
+
82
+ - Updated dependencies [34e8cfa]
83
+ - Updated dependencies [34e8cfa]
84
+ - Updated dependencies [34e8cfa]
85
+ - Updated dependencies [34e8cfa]
86
+ - Updated dependencies [34e8cfa]
87
+ - Updated dependencies [34e8cfa]
88
+ - Updated dependencies [34e8cfa]
89
+ - Updated dependencies [34e8cfa]
90
+ - Updated dependencies [34e8cfa]
91
+ - Updated dependencies [34e8cfa]
92
+ - Updated dependencies [34e8cfa]
93
+ - Updated dependencies [34e8cfa]
94
+ - Updated dependencies [34e8cfa]
95
+ - Updated dependencies [34e8cfa]
96
+ - Updated dependencies [34e8cfa]
97
+ - Updated dependencies [34e8cfa]
98
+ - Updated dependencies [34e8cfa]
99
+ - Updated dependencies [34e8cfa]
100
+ - Updated dependencies [34e8cfa]
101
+ - Updated dependencies [34e8cfa]
102
+ - Updated dependencies [34e8cfa]
103
+ - Updated dependencies [34e8cfa]
104
+ - Updated dependencies [34e8cfa]
105
+ - Updated dependencies [34e8cfa]
106
+ - Updated dependencies [34e8cfa]
107
+ - Updated dependencies [34e8cfa]
108
+ - Updated dependencies [34e8cfa]
109
+ - Updated dependencies [34e8cfa]
110
+ - Updated dependencies [34e8cfa]
111
+ - Updated dependencies [34e8cfa]
112
+ - Updated dependencies [34e8cfa]
113
+ - Updated dependencies [34e8cfa]
114
+ - @ac-kit/algo@0.5.0
115
+ - @ac-kit/math-random@0.4.0
116
+ - @ac-kit/math-stats@0.5.0
117
+ - @ac-bench/core@0.3.0
118
+ - @ac-kit/core@0.12.0
119
+ - @ac-kit/model-dataset@0.2.0
120
+ - @ac-kit/app-report@0.3.0
121
+
3
122
  ## 0.1.11
4
123
 
5
124
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"_run-case.d.ts","sourceRoot":"","sources":["../src/_run-case.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAe,MAAM,cAAc,CAAC;AAU3D,OAAO,EACN,uBAAuB,EACvB,4BAA4B,EAC5B,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,0BAA0B,GAAG,uBAAuB,GAAG;IAClE,gBAAgB,CAAC,EAAE,4BAA4B,CAAC;CAChD,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACxC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,mBAAmB,EAC5B,OAAO,CAAC,EAAE,0BAA0B,GAClC,OAAO,CAAC,IAAI,CAAC,CA4Df"}
1
+ {"version":3,"file":"_run-case.d.ts","sourceRoot":"","sources":["../src/_run-case.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAqB,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAU9C,OAAO,EACN,uBAAuB,EACvB,4BAA4B,EAC5B,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,0BAA0B,GAAG,uBAAuB,GAAG;IAClE,gBAAgB,CAAC,EAAE,4BAA4B,CAAC;CAChD,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACxC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,mBAAmB,EAC5B,OAAO,CAAC,EAAE,0BAA0B,GAClC,OAAO,CAAC,IAAI,CAAC,CAiDf"}
package/dist/_run-case.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { hrtime } from "node:process";
2
- import { formatError } from "@ac-kit/core";
2
+ import { reportCaseFailure } from "@ac-bench/core/runner";
3
3
  import { mulberry32 } from "@ac-kit/math-random";
4
4
  import { DEFAULT_LEAK_THRESHOLD, DEFAULT_SEED, runDudectCheck, } from "./_dudect.js";
5
5
  import { detectConstantTimeWarnings_ } from "./_warnings.js";
@@ -42,20 +42,15 @@ export async function runConstantTimeCase(title, classA, classB, context, option
42
42
  });
43
43
  }
44
44
  catch (error) {
45
- let failureMessage;
46
- try {
47
- await options?.teardown?.(context.signal);
48
- failureMessage = formatError(error);
49
- }
50
- catch (tearDownError) {
51
- failureMessage = formatError(new SuppressedError(tearDownError, error, "teardown failed after case failure"));
52
- }
53
- context.setCaseResult({
54
- title,
55
- tags,
56
- dudectResult: null,
57
- warnings: [],
58
- failureMessage,
45
+ await reportCaseFailure(context, error, {
46
+ ...(options?.teardown ? { teardown: options.teardown } : {}),
47
+ result: (failureMessage) => ({
48
+ title,
49
+ tags,
50
+ dudectResult: null,
51
+ warnings: [],
52
+ failureMessage,
53
+ }),
59
54
  });
60
55
  }
61
56
  }
@@ -1 +1 @@
1
- {"version":3,"file":"_run-case.js","sourceRoot":"","sources":["../src/_run-case.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,OAAO,EAAkB,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EACN,sBAAsB,EACtB,YAAY,EACZ,cAAc,GACd,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAU7D;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACxC,KAAa,EACb,MAAsB,EACtB,MAAsB,EACtB,OAA4B,EAC5B,OAAoC;IAEpC,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;IAEhC,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC;IACjC,MAAM,aAAa,GAClB,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,IAAI,sBAAsB,CAAC;IAE5E,MAAM,aAAa,GAAG,OAAO,EAAE,UAAU;QACxC,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;QAC5C,CAAC,CAAC,SAAS,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MAAM,EAAE,MAAM,EAAE;YACzD,GAAG,OAAO,EAAE,gBAAgB,EAAE,MAAM;YACpC,MAAM,EACL,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,IAAI,UAAU,CAAC,YAAY,CAAC;YACtE,GAAG,EAAE,MAAM,CAAC,MAAM;YAClB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,aAAa;YACb,YAAY;SACZ,CAAC,CAAC;QAEH,MAAM,OAAO,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAE1C,OAAO,CAAC,aAAa,CAAC;YACrB,KAAK;YACL,IAAI;YACJ,YAAY;YACZ,QAAQ,EAAE,2BAA2B,CAAC,YAAY,EAAE,aAAa,CAAC;YAClE,cAAc,EAAE,IAAI;SACa,CAAC,CAAC;IACrC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,iBAAiB,CAAC,OAAO,EAAE,KAAK,EAAE;YACvC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5D,MAAM,EAAE,CAAC,cAAc,EAAE,EAAE,CAC1B,CAAC;gBACA,KAAK;gBACL,IAAI;gBACJ,YAAY,EAAE,IAAI;gBAClB,QAAQ,EAAE,EAAE;gBACZ,cAAc;aACd,CAAkC;SACpC,CAAC,CAAC;IACJ,CAAC;AACF,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { afterAll, afterEach, beforeAll, beforeEach, } from "@ac-bench/core/runner";
1
+ export { afterAll, afterEach, beforeAll, beforeEach, boundGate, differenceGate, ratioGate, registerGate, } from "@ac-bench/core/runner";
2
2
  export * from "./decl.js";
3
3
  export * from "./options.js";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -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,GACV,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":"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"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { afterAll, afterEach, beforeAll, beforeEach, } from "@ac-bench/core/runner";
1
+ export { afterAll, afterEach, beforeAll, beforeEach, boundGate, differenceGate, ratioGate, registerGate, } from "@ac-bench/core/runner";
2
2
  export * from "./decl.js";
3
3
  export * from "./options.js";
4
4
  //# 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,GACV,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,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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ac-bench/measure-constant-time",
3
- "version": "0.1.11",
3
+ "version": "0.2.1",
4
4
  "description": "dudect-style constant-time measure for @ac-bench: times two closures under a randomly interleaved schedule and reports Welch's t-statistic.",
5
5
  "keywords": [
6
6
  "benchmark",
@@ -47,26 +47,26 @@
47
47
  "prepack": "yarn build"
48
48
  },
49
49
  "dependencies": {
50
- "@ac-bench/core": "^0.2.5",
51
- "@ac-kit/algo": "^0.4.1",
52
- "@ac-kit/app-report": "^0.2.4",
53
- "@ac-kit/core": "^0.11.0",
54
- "@ac-kit/math-random": "^0.3.0",
55
- "@ac-kit/math-stats": "^0.4.0",
56
- "@ac-kit/model-dataset": "^0.1.0",
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-random": "^0.4.1",
55
+ "@ac-kit/math-stats": "^0.6.0",
56
+ "@ac-kit/model-dataset": "^0.3.0",
57
57
  "zod": "^4.5.4"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@ac-kit/tsconfig": "0.1.0",
61
61
  "@ac-kit/typedoc-config": "0.1.0",
62
- "@ac-kit/vitest-config": "0.1.1",
63
- "@types/node": "26.6.6",
62
+ "@ac-kit/vitest-config": "0.2.0",
63
+ "@types/node": "26.6.11",
64
64
  "@typescript/native": "typescript@7.0.2",
65
65
  "rimraf": "6.1.4",
66
66
  "typedoc": "0.28.20",
67
67
  "typescript": "@typescript/typescript6@6.0.2",
68
- "vite": "8.3.8",
69
- "vitest": "5.1.1"
68
+ "vite": "8.4.0",
69
+ "vitest": "5.1.2"
70
70
  },
71
71
  "engines": {
72
72
  "node": ">=24"