@ac-bench/reporter-json 0.1.1 → 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 +34 -0
- package/README.md +6 -3
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -17
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @ac-bench/reporter-json
|
|
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
|
+
- @ac-bench/core@0.3.0
|
|
35
|
+
- @ac-kit/app-report@0.3.0
|
|
36
|
+
|
|
3
37
|
## 0.1.1
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# @ac-bench/reporter-json
|
|
2
2
|
|
|
3
|
-
Writes a benchmark run to a single JSON document,
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Writes a benchmark run to a single JSON document, the archive
|
|
4
|
+
(`format: "ac-bench-archive"`, version 1), when the run ends: the run's
|
|
5
|
+
description, the machine, the runtimes, and every condition with its titles,
|
|
6
|
+
the answer of each case and the executions behind it. A case's answer is
|
|
7
|
+
whatever the measure's own plugin produces for JSON; raw samples are left out
|
|
8
|
+
unless the run was started with `--emit-samples`.
|
|
6
9
|
|
|
7
10
|
```ts
|
|
8
11
|
import { defineConfig } from "@ac-bench/cli";
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ export type JsonReporterOptions = {
|
|
|
3
3
|
/** Where to write. Default: the run's output base name plus `.json`. */
|
|
4
4
|
readonly output?: string;
|
|
5
5
|
};
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* The whole run as one JSON archive (`BenchArchive`), written when the run
|
|
8
|
+
* ends.
|
|
9
|
+
*/
|
|
7
10
|
export default function jsonReporter(options?: JsonReporterOptions): ReporterPlugin;
|
|
8
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAIzE,MAAM,MAAM,mBAAmB,GAAG;IACjC,wEAAwE;IACxE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CACnC,OAAO,GAAE,mBAAwB,GAC/B,cAAc,CAYhB"}
|
package/dist/index.js
CHANGED
|
@@ -1,25 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { ArchiveBuilder, defineReporterPlugin } from "@ac-bench/core/plugin";
|
|
2
|
+
/**
|
|
3
|
+
* The whole run as one JSON archive (`BenchArchive`), written when the run
|
|
4
|
+
* ends.
|
|
5
|
+
*/
|
|
4
6
|
export default function jsonReporter(options = {}) {
|
|
5
7
|
return defineReporterPlugin({
|
|
6
8
|
id: "json",
|
|
7
|
-
createSink: (context) => new
|
|
9
|
+
createSink: (context) => new ArchiveSink_(new ArchiveBuilder({
|
|
10
|
+
registry: context.registry,
|
|
11
|
+
emitSamples: context.emitSamples === true,
|
|
12
|
+
}), context.openOutput(options.output ?? `${context.defaultOutput}.json`)),
|
|
8
13
|
});
|
|
9
14
|
}
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
/** Folds events into the archive as they come, and writes it once at close. */
|
|
16
|
+
class ArchiveSink_ {
|
|
17
|
+
builder;
|
|
18
|
+
writer;
|
|
19
|
+
constructor(builder, stream) {
|
|
20
|
+
this.builder = builder;
|
|
21
|
+
this.writer = stream.getWriter();
|
|
22
|
+
}
|
|
23
|
+
write(event) {
|
|
24
|
+
this.builder.write(event);
|
|
25
|
+
}
|
|
26
|
+
async flush() {
|
|
27
|
+
await this.writer.ready;
|
|
28
|
+
}
|
|
29
|
+
/** A run that described nothing (a listing) has no archive to write. */
|
|
30
|
+
async close() {
|
|
31
|
+
if (this.builder.described) {
|
|
32
|
+
await this.writer.write(`${JSON.stringify(this.builder.build(), null, 2)}\n`);
|
|
21
33
|
}
|
|
22
|
-
|
|
23
|
-
}
|
|
34
|
+
await this.writer.close();
|
|
35
|
+
}
|
|
24
36
|
}
|
|
25
37
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAQ7E;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CACnC,OAAO,GAAwB,EAAE;IAEjC,OAAO,oBAAoB,CAAC;QAC3B,EAAE,EAAE,MAAM;QACV,UAAU,EAAE,CAAC,OAAO,EAAE,EAAE,CACvB,IAAI,YAAY,CACf,IAAI,cAAc,CAAC;YAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,WAAW,EAAE,OAAO,CAAC,WAAW,KAAK,IAAI;SACzC,CAAC,EACF,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,OAAO,CAAC,CACrE;KACF,CAAC,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,MAAM,YAAY;IACA,OAAO,CAAiB;IACxB,MAAM,CAAsC;IAE7D,YAAY,OAAuB,EAAE,MAA8B;QAClE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,KAA+B;QACpC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,KAAK;QACV,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;IACzB,CAAC;IAED,wEAAwE;IACxE,KAAK,CAAC,KAAK;QACV,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;YAC5B,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CACpD,CAAC;QACH,CAAC;QACD,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;CACD"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ac-bench/reporter-json",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "JSON reporter for @ac-bench: writes a run
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "JSON reporter for @ac-bench: writes a run as one archive document, conditions titled and keyed, without raw samples unless asked.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"benchmark",
|
|
7
7
|
"json",
|
|
@@ -43,21 +43,21 @@
|
|
|
43
43
|
"prepack": "yarn build"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@ac-bench/core": "^0.
|
|
47
|
-
"@ac-kit/app-report": "^0.
|
|
48
|
-
"@types/web": "^0.0.
|
|
46
|
+
"@ac-bench/core": "^0.3.0",
|
|
47
|
+
"@ac-kit/app-report": "^0.3.0",
|
|
48
|
+
"@types/web": "^0.0.367"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@ac-kit/model-dataset": "^0.
|
|
51
|
+
"@ac-kit/model-dataset": "^0.2.0",
|
|
52
52
|
"@ac-kit/tsconfig": "0.1.0",
|
|
53
53
|
"@ac-kit/typedoc-config": "0.1.0",
|
|
54
|
-
"@ac-kit/vitest-config": "0.
|
|
54
|
+
"@ac-kit/vitest-config": "0.2.0",
|
|
55
55
|
"@typescript/native": "typescript@7.0.2",
|
|
56
56
|
"rimraf": "6.1.4",
|
|
57
57
|
"typedoc": "0.28.20",
|
|
58
58
|
"typescript": "@typescript/typescript6@6.0.2",
|
|
59
|
-
"vite": "8.
|
|
60
|
-
"vitest": "5.1.
|
|
59
|
+
"vite": "8.4.0",
|
|
60
|
+
"vitest": "5.1.2"
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|
|
63
63
|
"node": ">=24"
|