@ac-bench/reporter-markdown 0.1.2 → 0.2.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,41 @@
1
1
  # @ac-bench/reporter-markdown
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 34e8cfa: Reports tell conditions apart. **`@ac-bench/reporter-json`** writes the archive
8
+ (`format: "ac-bench-archive"`, version 1) instead of one section per measure:
9
+ every condition keyed and titled, so two suites that each declare a case `new`
10
+ are two conditions, with the run, machine and runtime descriptions, and what a
11
+ gate reads: each execution's `processKey` and `observations` per gate metric,
12
+ each condition's `metrics`, the run's `gates` and `verdicts`, so
13
+ `@ac-bench/gate` evaluates it offline. It folds
14
+ events as they arrive and keeps no raw result, and writes nothing for a run that
15
+ described nothing (a listing). **Migration:** read `conditions[].cases[].result`
16
+ where you read `<measure>.conditions[]`. **`@ac-bench/reporter-markdown`** opens
17
+ with an environment section and renders one titled table per condition, its
18
+ heading on one line whatever the titles or file name hold.
19
+ **`@ac-bench/reporter-csv`** writes one table per condition, each row ending with
20
+ `runtime` and `condition` columns; a condition with no result is one row with
21
+ only those two filled. Neither asks a measure to conclude on a condition with
22
+ no result. **`@ac-bench/measure-duration`** leaves the
23
+ raw `timings` out of its JSON form unless the run was started with
24
+ `--emit-samples`; a six-case archive no longer weighs tens of megabytes.
25
+ **Duration, jitter, resource and constant-time** close a case that threw as
26
+ `failed` — its failure result is still reported — so the archive, the report
27
+ and the run's outcome count it as failed rather than measured.
28
+
29
+ ### Patch Changes
30
+
31
+ - Updated dependencies [34e8cfa]
32
+ - Updated dependencies [34e8cfa]
33
+ - Updated dependencies [34e8cfa]
34
+ - Updated dependencies [34e8cfa]
35
+ - @ac-bench/core@0.3.0
36
+ - @ac-kit/format-markdown@0.2.2
37
+ - @ac-kit/app-report@0.3.0
38
+
3
39
  ## 0.1.2
4
40
 
5
41
  ### Patch Changes
package/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # @ac-bench/reporter-markdown
2
2
 
3
- Writes a benchmark run as a GitHub-flavoured Markdown document, one table per
4
- measure, when the run ends. Suited to pasting into a pull request or committing
5
- next to the code the numbers describe.
3
+ Writes a benchmark run as a GitHub-flavoured Markdown document when the run
4
+ ends: an environment header (run, tool, machine, runtimes), then one table per
5
+ condition, titled by the condition's titles and its file. Suited to pasting into
6
+ a pull request or committing next to the code the numbers describe.
6
7
 
7
8
  ```ts
8
9
  import { defineConfig } from "@ac-bench/cli";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGX,cAAc,EACd,MAAM,uBAAuB,CAAC;AAW/B,MAAM,MAAM,uBAAuB,GAAG;IACrC,sEAAsE;IACtE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,+DAA+D;AAC/D,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACvC,OAAO,GAAE,uBAA4B,GACnC,cAAc,CAShB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGX,cAAc,EACd,MAAM,uBAAuB,CAAC;AAU/B,MAAM,MAAM,uBAAuB,GAAG;IACrC,sEAAsE;IACtE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,+DAA+D;AAC/D,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACvC,OAAO,GAAE,uBAA4B,GACnC,cAAc,CAShB"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { buildConditionInput, conditionFrame, defineReporterPlugin, groupCaseResultsByMeasure, } from "@ac-bench/core/plugin";
1
+ import { collectConditions, collectedConditionFrame, defineReporterPlugin, } from "@ac-bench/core/plugin";
2
2
  import { AggregateSink } from "@ac-kit/app-report";
3
3
  import { renderFrameAsMarkdown } from "@ac-kit/format-markdown";
4
4
  /** The whole run as one GitHub-flavoured Markdown document. */
@@ -8,19 +8,44 @@ export default function markdownReporter(options = {}) {
8
8
  createSink: (context) => new AggregateSink(context.openOutput(options.output ?? `${context.defaultOutput}.md`), formatMarkdown_(context)),
9
9
  });
10
10
  }
11
- /** Renders every measure present in `run`, one section each. */
11
+ /** The environment header, then one titled table per condition. */
12
12
  function formatMarkdown_(context) {
13
13
  return (run) => {
14
14
  const sections = [];
15
- for (const [measureId, caseResults] of groupCaseResultsByMeasure(run.data)) {
16
- if (caseResults.length === 0) {
17
- continue;
18
- }
19
- const plugin = context.registry.resolve(measureId);
20
- const frame = conditionFrame(plugin, buildConditionInput(measureId, caseResults));
15
+ const header = environmentHeader_(run.data);
16
+ if (header !== null) {
17
+ sections.push(header);
18
+ }
19
+ for (const condition of collectConditions(run)) {
20
+ const frame = collectedConditionFrame(context.registry.resolve(condition.measure), condition);
21
21
  sections.push(renderFrameAsMarkdown(frame));
22
22
  }
23
23
  return `${sections.join("\n\n")}\n`;
24
24
  };
25
25
  }
26
+ /** What ran and where, as a list; `null` when the run described nothing. */
27
+ function environmentHeader_(data) {
28
+ const description = data.find((item) => item.kind === "run-description");
29
+ if (description === undefined) {
30
+ return null;
31
+ }
32
+ const { run, machine } = description;
33
+ const cores = machine.availableParallelism === machine.logicalCores
34
+ ? `${machine.logicalCores} logical cores`
35
+ : `${machine.logicalCores} logical cores (${machine.availableParallelism} available to the run)`;
36
+ const lines = [
37
+ "## Environment",
38
+ "",
39
+ `- Run: ${run.id}, started ${run.startedAt}`,
40
+ `- Tool: ${run.tool.name} ${run.tool.version}${run.mode === null ? "" : `, mode ${run.mode}`}`,
41
+ `- Machine: ${machine.cpuModel}, ${cores}, ${machine.memoryGiB} GiB, ${machine.os} ${machine.kernelRelease} (${machine.architecture})`,
42
+ ];
43
+ for (const item of data) {
44
+ if (item.kind === "runtime-description") {
45
+ const { runtime } = item;
46
+ lines.push(`- Runtime ${runtime.id}: ${runtime.product} ${runtime.version}, ${runtime.engine}, ${runtime.isolation} isolation, clock ${runtime.clock.resolutionMs} ms`);
47
+ }
48
+ }
49
+ return lines.join("\n");
50
+ }
26
51
  //# 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":"AAKA,OAAO,EACN,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,yBAAyB,GACzB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAOhE,+DAA+D;AAC/D,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACvC,OAAO,GAA4B,EAAE;IAErC,OAAO,oBAAoB,CAAC;QAC3B,EAAE,EAAE,UAAU;QACd,UAAU,EAAE,CAAC,OAAO,EAAE,EAAE,CACvB,IAAI,aAAa,CAChB,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,KAAK,CAAC,EACnE,eAAe,CAAC,OAAO,CAAC,CACxB;KACF,CAAC,CAAC;AACJ,CAAC;AAED,gEAAgE;AAChE,SAAS,eAAe,CACvB,OAAwB;IAExB,OAAO,CAAC,GAAG,EAAE,EAAE;QACd,MAAM,QAAQ,GAAa,EAAE,CAAC;QAE9B,KAAK,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,yBAAyB,CAC/D,GAAG,CAAC,IAAI,CACR,EAAE,CAAC;YACH,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC9B,SAAS;YACV,CAAC;YACD,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YACnD,MAAM,KAAK,GAAG,cAAc,CAC3B,MAAM,EACN,mBAAmB,CA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IAAI,IAAI,IAAI,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,IAAI,KAAK,qBAAqB,EAAE,CAAC;YACzC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;YACzB,KAAK,CAAC,IAAI,CACT,aAAa,OAAO,CAAC,EAAE,KAAK,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,KAAK,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC,SAAS,qBAAqB,OAAO,CAAC,KAAK,CAAC,YAAY,KAAK,CAC3J,CAAC;QACH,CAAC;IACF,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ac-bench/reporter-markdown",
3
- "version": "0.1.2",
4
- "description": "Markdown reporter for @ac-bench: writes a run as a GitHub-flavoured document, one table per measure.",
3
+ "version": "0.2.0",
4
+ "description": "Markdown reporter for @ac-bench: writes a run as a GitHub-flavoured document, an environment header then one table per condition.",
5
5
  "keywords": [
6
6
  "benchmark",
7
7
  "gfm",
@@ -44,22 +44,22 @@
44
44
  "prepack": "yarn build"
45
45
  },
46
46
  "dependencies": {
47
- "@ac-bench/core": "^0.2.4",
48
- "@ac-kit/app-report": "^0.2.3",
49
- "@ac-kit/format-markdown": "^0.2.0",
47
+ "@ac-bench/core": "^0.3.0",
48
+ "@ac-kit/app-report": "^0.3.0",
49
+ "@ac-kit/format-markdown": "^0.2.2",
50
50
  "@types/web": "^0.0.367"
51
51
  },
52
52
  "devDependencies": {
53
- "@ac-kit/model-dataset": "^0.1.0",
53
+ "@ac-kit/model-dataset": "^0.2.0",
54
54
  "@ac-kit/tsconfig": "0.1.0",
55
55
  "@ac-kit/typedoc-config": "0.1.0",
56
- "@ac-kit/vitest-config": "0.1.1",
56
+ "@ac-kit/vitest-config": "0.2.0",
57
57
  "@typescript/native": "typescript@7.0.2",
58
58
  "rimraf": "6.1.4",
59
59
  "typedoc": "0.28.20",
60
60
  "typescript": "@typescript/typescript6@6.0.2",
61
- "vite": "8.3.8",
62
- "vitest": "5.1.1"
61
+ "vite": "8.4.0",
62
+ "vitest": "5.1.2"
63
63
  },
64
64
  "engines": {
65
65
  "node": ">=24"