@cobol-ts/cli-benchmark 0.0.0-stage → 0.0.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/README.md +9 -3
  2. package/dist/index.d.ts +10 -0
  3. package/dist/index.js +27 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/src/benchmark.access.spec.d.ts +1 -0
  6. package/dist/src/benchmark.access.spec.js +30 -0
  7. package/dist/src/benchmark.access.spec.js.map +1 -0
  8. package/dist/src/benchmark.aggregate.fixture.d.ts +10 -0
  9. package/dist/src/benchmark.aggregate.fixture.js +110 -0
  10. package/dist/src/benchmark.aggregate.fixture.js.map +1 -0
  11. package/dist/src/benchmark.allocations.d.ts +19 -0
  12. package/dist/src/benchmark.allocations.js +83 -0
  13. package/dist/src/benchmark.allocations.js.map +1 -0
  14. package/dist/src/benchmark.allocations.spec.d.ts +1 -0
  15. package/dist/src/benchmark.allocations.spec.js +64 -0
  16. package/dist/src/benchmark.allocations.spec.js.map +1 -0
  17. package/dist/src/benchmark.builder.d.ts +8 -0
  18. package/dist/src/benchmark.builder.js +21 -0
  19. package/dist/src/benchmark.builder.js.map +1 -0
  20. package/dist/src/benchmark.calibration.spec.d.ts +1 -0
  21. package/dist/src/benchmark.calibration.spec.js +83 -0
  22. package/dist/src/benchmark.calibration.spec.js.map +1 -0
  23. package/dist/src/benchmark.command.d.ts +8 -0
  24. package/dist/src/benchmark.command.js +368 -0
  25. package/dist/src/benchmark.command.js.map +1 -0
  26. package/dist/src/benchmark.composed.fixture.d.ts +4 -0
  27. package/dist/src/benchmark.composed.fixture.js +80 -0
  28. package/dist/src/benchmark.composed.fixture.js.map +1 -0
  29. package/dist/src/benchmark.composed.fixture.spec.d.ts +1 -0
  30. package/dist/src/benchmark.composed.fixture.spec.js +52 -0
  31. package/dist/src/benchmark.composed.fixture.spec.js.map +1 -0
  32. package/dist/src/benchmark.composed.runner.d.ts +14 -0
  33. package/dist/src/benchmark.composed.runner.js +197 -0
  34. package/dist/src/benchmark.composed.runner.js.map +1 -0
  35. package/dist/src/benchmark.composed.two.fixture.d.ts +5 -0
  36. package/dist/src/benchmark.composed.two.fixture.js +118 -0
  37. package/dist/src/benchmark.composed.two.fixture.js.map +1 -0
  38. package/dist/src/benchmark.configuration.d.ts +19 -0
  39. package/dist/src/benchmark.configuration.js +111 -0
  40. package/dist/src/benchmark.configuration.js.map +1 -0
  41. package/dist/src/benchmark.configuration.spec.d.ts +1 -0
  42. package/dist/src/benchmark.configuration.spec.js +28 -0
  43. package/dist/src/benchmark.configuration.spec.js.map +1 -0
  44. package/dist/src/benchmark.dependencies.d.ts +37 -0
  45. package/dist/src/benchmark.dependencies.js +3 -0
  46. package/dist/src/benchmark.dependencies.js.map +1 -0
  47. package/dist/src/benchmark.engine.d.ts +31 -0
  48. package/dist/src/benchmark.engine.js +47 -0
  49. package/dist/src/benchmark.engine.js.map +1 -0
  50. package/dist/src/benchmark.engine.spec.d.ts +1 -0
  51. package/dist/src/benchmark.engine.spec.js +116 -0
  52. package/dist/src/benchmark.engine.spec.js.map +1 -0
  53. package/dist/src/benchmark.execution.d.ts +22 -0
  54. package/dist/src/benchmark.execution.js +64 -0
  55. package/dist/src/benchmark.execution.js.map +1 -0
  56. package/dist/src/benchmark.execution.spec.d.ts +1 -0
  57. package/dist/src/benchmark.execution.spec.js +74 -0
  58. package/dist/src/benchmark.execution.spec.js.map +1 -0
  59. package/dist/src/benchmark.format.fixture.d.ts +26 -0
  60. package/dist/src/benchmark.format.fixture.js +186 -0
  61. package/dist/src/benchmark.format.fixture.js.map +1 -0
  62. package/dist/src/benchmark.format.oracle.d.ts +8 -0
  63. package/dist/src/benchmark.format.oracle.js +30 -0
  64. package/dist/src/benchmark.format.oracle.js.map +1 -0
  65. package/dist/src/benchmark.format.runner.d.ts +8 -0
  66. package/dist/src/benchmark.format.runner.js +202 -0
  67. package/dist/src/benchmark.format.runner.js.map +1 -0
  68. package/dist/src/benchmark.format.source.d.ts +5 -0
  69. package/dist/src/benchmark.format.source.js +16 -0
  70. package/dist/src/benchmark.format.source.js.map +1 -0
  71. package/dist/src/benchmark.gc.d.ts +39 -0
  72. package/dist/src/benchmark.gc.js +83 -0
  73. package/dist/src/benchmark.gc.js.map +1 -0
  74. package/dist/src/benchmark.gc.spec.d.ts +1 -0
  75. package/dist/src/benchmark.gc.spec.js +50 -0
  76. package/dist/src/benchmark.gc.spec.js.map +1 -0
  77. package/dist/src/benchmark.history.d.ts +15 -0
  78. package/dist/src/benchmark.history.js +71 -0
  79. package/dist/src/benchmark.history.js.map +1 -0
  80. package/dist/src/benchmark.init.d.ts +6 -0
  81. package/dist/src/benchmark.init.js +34 -0
  82. package/dist/src/benchmark.init.js.map +1 -0
  83. package/dist/src/benchmark.measurement.d.ts +15 -0
  84. package/dist/src/benchmark.measurement.js +15 -0
  85. package/dist/src/benchmark.measurement.js.map +1 -0
  86. package/dist/src/benchmark.options.d.ts +29 -0
  87. package/dist/src/benchmark.options.js +53 -0
  88. package/dist/src/benchmark.options.js.map +1 -0
  89. package/dist/src/benchmark.periodic.fixture.d.ts +5 -0
  90. package/dist/src/benchmark.periodic.fixture.js +71 -0
  91. package/dist/src/benchmark.periodic.fixture.js.map +1 -0
  92. package/dist/src/benchmark.periodic.fixture.spec.d.ts +1 -0
  93. package/dist/src/benchmark.periodic.fixture.spec.js +97 -0
  94. package/dist/src/benchmark.periodic.fixture.spec.js.map +1 -0
  95. package/dist/src/benchmark.profile.d.ts +9 -0
  96. package/dist/src/benchmark.profile.js +68 -0
  97. package/dist/src/benchmark.profile.js.map +1 -0
  98. package/dist/src/benchmark.profile.spec.d.ts +1 -0
  99. package/dist/src/benchmark.profile.spec.js +65 -0
  100. package/dist/src/benchmark.profile.spec.js.map +1 -0
  101. package/dist/src/benchmark.record.d.ts +16 -0
  102. package/dist/src/benchmark.record.js +34 -0
  103. package/dist/src/benchmark.record.js.map +1 -0
  104. package/dist/src/benchmark.report.d.ts +131 -0
  105. package/dist/src/benchmark.report.edges.spec.d.ts +1 -0
  106. package/dist/src/benchmark.report.edges.spec.js +25 -0
  107. package/dist/src/benchmark.report.edges.spec.js.map +1 -0
  108. package/dist/src/benchmark.report.js +372 -0
  109. package/dist/src/benchmark.report.js.map +1 -0
  110. package/dist/src/benchmark.report.spec.d.ts +1 -0
  111. package/dist/src/benchmark.report.spec.js +304 -0
  112. package/dist/src/benchmark.report.spec.js.map +1 -0
  113. package/dist/src/benchmark.runner.d.ts +30 -0
  114. package/dist/src/benchmark.runner.js +257 -0
  115. package/dist/src/benchmark.runner.js.map +1 -0
  116. package/dist/src/benchmark.state.digest.d.ts +7 -0
  117. package/dist/src/benchmark.state.digest.js +28 -0
  118. package/dist/src/benchmark.state.digest.js.map +1 -0
  119. package/dist/src/benchmark.state.digest.spec.d.ts +1 -0
  120. package/dist/src/benchmark.state.digest.spec.js +30 -0
  121. package/dist/src/benchmark.state.digest.spec.js.map +1 -0
  122. package/index.ts +10 -0
  123. package/package.json +81 -3
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runBenchmarkDefinition = runBenchmarkDefinition;
4
+ const benchmark_measurement_1 = require("./benchmark.measurement");
5
+ function positiveInteger(value) {
6
+ return Number.isSafeInteger(value) && value > 0;
7
+ }
8
+ /** Validate and select operations once, before opening any workload. */
9
+ function prepare(definition) {
10
+ const { records, runs, warmup, operations, profile } = definition;
11
+ if ((records !== undefined && !positiveInteger(records)) || !positiveInteger(runs) || !Number.isSafeInteger(warmup) || warmup < 0)
12
+ throw new Error('Benchmark requires positive integer runs, optional positive integer records, and a nonnegative integer warmup');
13
+ const byName = new Map(operations.map(operation => [operation.name, operation]));
14
+ if (!operations.length || byName.size !== operations.length || operations.some(operation => !operation.name.trim()))
15
+ throw new Error('Benchmark requires nonempty, unique operation names');
16
+ if (profile && !byName.has(profile.operation))
17
+ throw new Error(`Unknown profile operation ${profile.operation}`);
18
+ if (operations.some(operation => operation.timingSampleEvery !== undefined && !positiveInteger(operation.timingSampleEvery)))
19
+ throw new Error('Benchmark timing sample interval must be a positive integer');
20
+ if (profile && operations.some(operation => operation.timingSampleEvery !== undefined))
21
+ throw new Error('Graph timing and sampling profiles must be measured separately');
22
+ }
23
+ /** Workloads own their clock and early-termination diagnostics. The engine owns
24
+ * scheduling and instrumentation, not physical data or report formatting. */
25
+ async function runBenchmarkDefinition(definition, onRound = () => { }, services) {
26
+ prepare(definition);
27
+ const { records, runs, operations, gc, profile } = definition;
28
+ const warmup = Math.min(records ?? Infinity, definition.warmup);
29
+ const warmed = [];
30
+ if (warmup)
31
+ for (const operation of operations)
32
+ warmed.push({ operation: operation.name, measurement: await operation.execute({ records: warmup }) });
33
+ const rounds = [];
34
+ for (let index = 0; index < runs; index++) {
35
+ const round = [];
36
+ for (const operation of operations) {
37
+ const context = { records, ...(operation.timingSampleEvery === undefined ? {} : { timingSampleEvery: operation.timingSampleEvery }) };
38
+ const selectedProfile = index === 0 && profile?.operation === operation.name ? profile : undefined;
39
+ const measurement = await (0, benchmark_measurement_1.measureBenchmarkPass)(() => operation.execute(context), gc, selectedProfile, services);
40
+ round.push({ operation: operation.name, measurement });
41
+ }
42
+ rounds.push(round);
43
+ await onRound(round, index, warmed);
44
+ }
45
+ return rounds;
46
+ }
47
+ //# sourceMappingURL=benchmark.engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"benchmark.engine.js","sourceRoot":"","sources":["../../src/benchmark.engine.ts"],"names":[],"mappings":";;AAuDA,wDAqBC;AA5ED,mEAA6G;AAiC7G,SAAS,eAAe,CAAC,KAAa;IAClC,OAAO,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAA;AACnD,CAAC;AAED,wEAAwE;AACxE,SAAS,OAAO,CAAC,UAA+B;IAC5C,MAAM,EAAC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAC,GAAG,UAAU,CAA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A;YAC/G,KAAK,CAAC,IAAI,CAAC,EAAC,SAAS,EAAE,SAAS,CAAC,IAAI,EAAE,WAAW,EAAC,CAAC,CAAA;QACxD,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAClB,MAAM,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IACvC,CAAC;IACD,OAAO,MAAM,CAAA;AACjB,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const benchmark_builder_1 = require("./benchmark.builder");
4
+ const benchmark_engine_1 = require("./benchmark.engine");
5
+ const benchmark_measurement_1 = require("./benchmark.measurement");
6
+ const benchmark_options_1 = require("./benchmark.options");
7
+ const pass = (records) => ({ records, totalMs: 2, celMs: 0 });
8
+ const gc = { collections: 1, reclaimedBytes: 32 };
9
+ function instruments(events) {
10
+ return {
11
+ gc: async (action) => {
12
+ events.push('gc:start');
13
+ try {
14
+ return { value: await action(), gc };
15
+ }
16
+ finally {
17
+ events.push('gc:stop');
18
+ }
19
+ },
20
+ profile: async (kind, filename, action) => {
21
+ events.push(`${kind}:${filename}:start`);
22
+ try {
23
+ return await action();
24
+ }
25
+ finally {
26
+ events.push(`${kind}:stop`);
27
+ }
28
+ }
29
+ };
30
+ }
31
+ test('measurement preserves workload result and nests profiling outside GC', async () => {
32
+ const events = [];
33
+ const result = await (0, benchmark_measurement_1.measureBenchmarkPass)(async () => { events.push('work'); return { ...pass(3), stateDigest: '0x01' }; }, true, { kind: 'cpu', filename: 'read.cpuprofile' }, instruments(events));
34
+ expect(result).toEqual({ ...pass(3), stateDigest: '0x01', gc });
35
+ expect(events).toEqual(['cpu:read.cpuprofile:start', 'gc:start', 'work', 'gc:stop', 'cpu:stop']);
36
+ });
37
+ test('measurement propagates the original failure and unwinds instrumentation', async () => {
38
+ const events = [];
39
+ const failure = new Error('decode failed');
40
+ await expect((0, benchmark_measurement_1.measureBenchmarkPass)(async () => { throw failure; }, true, { kind: 'allocation', filename: 'read.heapprofile' }, instruments(events))).rejects.toBe(failure);
41
+ expect(events).toEqual(['allocation:read.heapprofile:start', 'gc:start', 'gc:stop', 'allocation:stop']);
42
+ });
43
+ test('builder preserves warmup ordering, clamps counts, and profiles only the first selected measured pass', async () => {
44
+ const events = [];
45
+ const operation = (name) => async ({ records }) => {
46
+ events.push(`${name}:${records}`);
47
+ return pass(records);
48
+ };
49
+ const builder = (0, benchmark_builder_1.benchmark)({ records: 3, warmup: 10, runs: 2, gc: true,
50
+ profile: { operation: 'second', kind: 'cpu', filename: 'second.cpuprofile' } })
51
+ .measure('first', operation('first')).measure('second', operation('second'));
52
+ const rounds = await builder.run((_round, index) => { events.push(`round:${index}`); }, instruments(events));
53
+ expect(events).toEqual(['first:3', 'second:3', 'gc:start', 'first:3', 'gc:stop',
54
+ 'cpu:second.cpuprofile:start', 'gc:start', 'second:3', 'gc:stop', 'cpu:stop', 'round:0',
55
+ 'gc:start', 'first:3', 'gc:stop', 'gc:start', 'second:3', 'gc:stop', 'round:1']);
56
+ expect(rounds).toEqual(Array.from({ length: 2 }, () => ['first', 'second'].map(operation => ({ operation, measurement: { ...pass(3), gc } }))));
57
+ });
58
+ test('graph timing is passed only to the selected measured workload', async () => {
59
+ const contexts = [];
60
+ const execute = async (context) => { contexts.push(context); return pass(context.records); };
61
+ await (0, benchmark_builder_1.benchmark)({ records: 3, warmup: 1, runs: 1 }).measure('read', execute).measure('calculate', execute, 7).run();
62
+ expect(contexts).toEqual([{ records: 1 }, { records: 1 }, { records: 3 }, { records: 3, timingSampleEvery: 7 }]);
63
+ });
64
+ test('unlimited workloads use a bounded warmup and pass through the observed counts', async () => {
65
+ const contexts = [];
66
+ const warmups = [];
67
+ const execute = async (context) => {
68
+ contexts.push(context);
69
+ return pass(Math.min(context.records ?? Infinity, 3));
70
+ };
71
+ const rounds = await (0, benchmark_builder_1.benchmark)({ warmup: 1000, runs: 2 }).measure('read', execute)
72
+ .run((_round, _index, warmed) => { warmups.push(warmed); });
73
+ expect(contexts).toEqual([{ records: 1000 }, { records: undefined }, { records: undefined }]);
74
+ expect(rounds).toEqual([[{ operation: 'read', measurement: pass(3) }], [{ operation: 'read', measurement: pass(3) }]]);
75
+ expect(warmups).toEqual(rounds);
76
+ });
77
+ test('a failed workload stops execution without publishing an incomplete round', async () => {
78
+ const events = [];
79
+ const failure = new Error('scan ended early: 1/3');
80
+ await expect((0, benchmark_builder_1.benchmark)({ records: 3, warmup: 0, runs: 2 })
81
+ .measure('read', async () => { events.push('read'); return pass(3); })
82
+ .measure('calculate', async () => { throw failure; })
83
+ .measure('later', async () => { events.push('later'); return pass(3); })
84
+ .run(() => { events.push('round'); })).rejects.toBe(failure);
85
+ expect(events).toEqual(['read']);
86
+ });
87
+ test('built definitions are independent of later measure calls', () => {
88
+ const builder = (0, benchmark_builder_1.benchmark)({ records: 1, warmup: 0, runs: 1 }).measure('read', async () => pass(1));
89
+ const first = builder.build();
90
+ builder.measure('calculate', async () => pass(1));
91
+ expect(first.operations.map(operation => operation.name)).toEqual(['read']);
92
+ expect(builder.build().operations.map(operation => operation.name)).toEqual(['read', 'calculate']);
93
+ });
94
+ const definition = { records: 3, warmup: 1, runs: 2, operations: [{ name: 'read', execute: async () => pass(3) }] };
95
+ test.each([
96
+ [{ records: 0 }, 'Benchmark requires positive integer runs, optional positive integer records, and a nonnegative integer warmup'],
97
+ [{ operations: [] }, 'Benchmark requires nonempty, unique operation names'],
98
+ [{ operations: [...definition.operations, ...definition.operations] }, 'Benchmark requires nonempty, unique operation names'],
99
+ [{ profile: { kind: 'cpu', filename: 'x', operation: 'missing' } }, 'Unknown profile operation missing'],
100
+ [{ operations: [{ ...definition.operations[0], timingSampleEvery: 0 }] }, 'Benchmark timing sample interval must be a positive integer'],
101
+ [{ profile: { kind: 'cpu', filename: 'x', operation: 'read' }, operations: [{ ...definition.operations[0], timingSampleEvery: 2 }] },
102
+ 'Graph timing and sampling profiles must be measured separately']
103
+ ])('rejects invalid engine definition %p', async (change, diagnostic) => {
104
+ await expect((0, benchmark_engine_1.runBenchmarkDefinition)({ ...definition, ...change })).rejects.toThrow(new Error(diagnostic));
105
+ });
106
+ const options = { directory: 'unused', log: () => { } };
107
+ test('shared option validation uses consistent diagnostics', () => {
108
+ const both = { ...options, cpuProfile: true, allocationProfile: true };
109
+ expect(() => (0, benchmark_options_1.validateProfilingOptions)(both)).toThrow(new Error('Choose either --cpu-profile or --allocation-profile, not both'));
110
+ expect(() => (0, benchmark_options_1.validateTimingMode)({ ...options, graphTiming: true }, ['read'])).toThrow(new Error('--graph-timing requires CEL benchmark mode'));
111
+ expect(() => (0, benchmark_options_1.resolveProfileMode)({ ...options, cpuProfile: true }, ['read'])).toThrow(new Error('Profile mode "cel" is not enabled; selected modes: read'));
112
+ expect((0, benchmark_options_1.resolveTimingSampleEvery)(options)).toEqual(100);
113
+ expect((0, benchmark_options_1.resolveTimingSampleEvery)({ ...options, graphTiming: true, timingSampleEvery: 5 })).toEqual(5);
114
+ expect((0, benchmark_options_1.resolveProfileMode)({ ...options, cpuProfile: true, profileMode: 'read' }, ['read'])).toEqual('read');
115
+ });
116
+ //# sourceMappingURL=benchmark.engine.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"benchmark.engine.spec.js","sourceRoot":"","sources":["../../src/benchmark.engine.spec.ts"],"names":[],"mappings":";;AAAA,2DAA6C;AAC7C,yDAAmF;AACnF,mEAAsF;AACtF,2DAA8H;AAG9H,MAAM,IAAI,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,CAAC,EAAC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAC,CAAC,CAAA;AACnE,MAAM,EAAE,GAAG,EAAC,WAAW,EAAE,CAAC,EAAE,cAAc,EAAE,EAAE,EAAC,CAAA;AAC/C,SAAS,WAAW,CAAC,MAAgB;IACjC,OAAO;QACH,EAAE,EAAE,KAAK,E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I,EAAC,CAAA;IACpE,MAAM,CAAC,GAAG,EAAE,CAAC,IAAA,4CAAwB,EAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC,CAAA;IAChI,MAAM,CAAC,GAAG,EAAE,CAAC,IAAA,sCAAkB,EAAC,EAAC,GAAG,OAAO,EAAE,WAAW,EAAE,IAAI,EAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC,CAAA;IAC5I,MAAM,CAAC,GAAG,EAAE,CAAC,IAAA,sCAAkB,EAAC,EAAC,GAAG,OAAO,EAAE,UAAU,EAAE,IAAI,EAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC,CAAA;IACxJ,MAAM,CAAC,IAAA,4CAAwB,EAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IACtD,MAAM,CAAC,IAAA,4CAAwB,EAAC,EAAC,GAAG,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC,EAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAClG,MAAM,CAAC,IAAA,sCAAkB,EAAC,EAAC,GAAG,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;AAC7G,CAAC,CAAC,CAAA"}
@@ -0,0 +1,22 @@
1
+ import type { BenchmarkOperation } from './benchmark.engine';
2
+ import type { BenchmarkMode, BenchmarkRunOptions } from './benchmark.options';
3
+ import { type BenchmarkReferencePreparation } from './benchmark.report';
4
+ type BenchmarkExecution = ({
5
+ readonly records: number;
6
+ readonly recordLimit?: never;
7
+ } | {
8
+ readonly records?: never;
9
+ readonly recordLimit?: number;
10
+ }) & {
11
+ readonly project: string;
12
+ readonly warmupRecords: number;
13
+ readonly runs: number;
14
+ readonly modes: readonly BenchmarkMode[];
15
+ readonly profileMode: BenchmarkMode;
16
+ readonly timingSampleEvery?: number;
17
+ readonly header: readonly string[];
18
+ readonly referencePreparation?: readonly BenchmarkReferencePreparation[];
19
+ };
20
+ /** Adapt the generic engine to the existing CLI report contract. */
21
+ export declare function executeBenchmark(options: BenchmarkRunOptions, execution: BenchmarkExecution, workloads: Readonly<Record<BenchmarkMode, BenchmarkOperation>>): Promise<import("./benchmark.report").BenchmarkReport>;
22
+ export {};
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeBenchmark = executeBenchmark;
4
+ const benchmark_profile_1 = require("./benchmark.profile");
5
+ const benchmark_builder_1 = require("./benchmark.builder");
6
+ const benchmark_report_1 = require("./benchmark.report");
7
+ /** Adapt the generic engine to the existing CLI report contract. */
8
+ async function executeBenchmark(options, execution, workloads) {
9
+ const { project, records, recordLimit, warmupRecords, runs, modes, profileMode, timingSampleEvery, header } = execution;
10
+ const profile = options.cpuProfile ? { kind: 'cpu', filename: (0, benchmark_profile_1.benchmarkProfileFilename)(project, profileMode, 'cpu'), operation: profileMode } :
11
+ options.allocationProfile ? { kind: 'allocation', filename: (0, benchmark_profile_1.benchmarkProfileFilename)(project, profileMode, 'allocation'), operation: profileMode } : undefined;
12
+ const builder = (0, benchmark_builder_1.benchmark)({ records: records ?? recordLimit, warmup: warmupRecords, runs, gc: options.gc, profile });
13
+ const order = ['read', 'project', 'cel'];
14
+ for (const mode of order.filter(mode => modes.includes(mode)))
15
+ builder.measure(mode, workloads[mode], mode === 'cel' ? timingSampleEvery : undefined);
16
+ const measurements = { read: [], project: [], cel: [] };
17
+ let actualWarmup = 0;
18
+ const report = () => (0, benchmark_report_1.createBenchmarkReport)({ project, node: process.versions.node, v8: process.versions.v8,
19
+ warmupRecords: actualWarmup, referencePreparation: execution.referencePreparation, loader: measurements.read,
20
+ ...(modes.includes('project') ? { projection: measurements.project } : {}),
21
+ ...(modes.includes('cel') ? { integrated: measurements.cel } : {}) });
22
+ const start = (count, warmed) => {
23
+ for (const line of (0, benchmark_report_1.formatBenchmarkStart)({ project, records: count, runs, node: process.versions.node,
24
+ v8: process.versions.v8, warmupRecords: warmed, withCel: modes.includes('cel') }))
25
+ options.log(line);
26
+ };
27
+ if (!options.json) {
28
+ for (const line of header)
29
+ options.log(line);
30
+ for (const load of execution.referencePreparation ?? [])
31
+ options.log((0, benchmark_report_1.formatReferenceLoad)(load, `before-warmup purpose=${load.purpose}`));
32
+ if (records !== undefined)
33
+ start(records, warmupRecords);
34
+ }
35
+ await builder.run((round, i, warmup) => {
36
+ for (const result of round)
37
+ measurements[result.operation].push(result.measurement);
38
+ if (i === 0) {
39
+ // Read is always first; warm-up is bounded by actual source exhaustion.
40
+ actualWarmup = warmup[0]?.measurement.records ?? 0;
41
+ if (!options.json && records === undefined)
42
+ start(measurements.read[0].records, actualWarmup);
43
+ }
44
+ if (options.json)
45
+ return;
46
+ if (measurements.read[i].records !== measurements.read[0].records)
47
+ throw new Error('Benchmark record counts do not match');
48
+ const measured = (0, benchmark_report_1.createBenchmarkPassReport)(i + 1, measurements.read[i], measurements.project[i], measurements.cel[i]);
49
+ for (const line of (0, benchmark_report_1.formatBenchmarkRound)(measured, !!options.gc))
50
+ options.log(line);
51
+ if (i === 0 && profile) {
52
+ options.log(`${profile.kind === 'cpu' ? 'CPU' : 'ALLOCATION'} PROFILE ${profile.filename}`);
53
+ options.log('PROFILE NOTE: Sampling changes measured timings; use unprofiled runs for throughput comparisons.');
54
+ }
55
+ });
56
+ const result = report();
57
+ if (options.json)
58
+ options.log(JSON.stringify(result, null, 2));
59
+ else
60
+ for (const line of (0, benchmark_report_1.formatBenchmarkEnd)(result, !!options.gc))
61
+ options.log(line);
62
+ return result;
63
+ }
64
+ //# sourceMappingURL=benchm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CAAC,CAAC,CAAE,EAAE,YAAY,CAAC,OAAQ,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,GAAI,CAAC,CAAC,CAAC,CAAC,CAAA;QACzH,KAAK,MAAM,IAAI,IAAI,IAAA,uCAAoB,EAAC,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;YAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAClF,IAAI,CAAC,KAAK,CAAC,IAAI,OAAO,EAAE,CAAC;YACrB,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,YAAY,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAA;YAC3F,OAAO,CAAC,GAAG,CAAC,kGAAkG,CAAC,CAAA;QACnH,CAAC;IACL,CAAC,CAAC,CAAA;IACF,MAAM,MAAM,GAAG,MAAM,EAAE,CAAA;IACvB,IAAI,OAAO,CAAC,IAAI;QAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;;QACzD,KAAK,MAAM,IAAI,IAAI,IAAA,qCAAkB,EAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;YAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACnF,OAAO,MAAM,CAAA;AACjB,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const benchmark_execution_1 = require("./benchmark.execution");
4
+ const benchmark_report_1 = require("./benchmark.report");
5
+ function workloads(events) {
6
+ const operation = (name) => async ({ records, timingSampleEvery }) => {
7
+ events.push(`${name}:${records}:${timingSampleEvery ?? '-'}`);
8
+ return { records: records, totalMs: 2, celMs: name === 'cel' ? 1 : 0,
9
+ ...(name === 'cel' ? { stateDigest: '0x01' } : {}) };
10
+ };
11
+ return { read: operation('read'), project: operation('project'), cel: operation('cel') };
12
+ }
13
+ test('CLI adapter uses consistent warmup and measured order and emits each completed round', async () => {
14
+ const events = [], output = [];
15
+ const report = await (0, benchmark_execution_1.executeBenchmark)({ directory: 'fixture', log: line => { output.push(line); events.push('log'); } }, { project: 'fixture', records: 3, warmupRecords: 2, runs: 2, modes: ['cel', 'read', 'project'],
16
+ profileMode: 'cel', header: ['WORKLOAD fixture'] }, workloads(events));
17
+ expect(events.slice(events.indexOf('read:2:-'), events.indexOf('read:2:-') + 11)).toEqual(['read:2:-', 'project:2:-', 'cel:2:-',
18
+ 'read:3:-', 'project:3:-', 'cel:3:-', 'log', 'log', 'read:3:-', 'project:3:-', 'cel:3:-']);
19
+ expect(output).toEqual(['WORKLOAD fixture', ...(0, benchmark_report_1.formatBenchmarkReport)(report)]);
20
+ expect(report.passes.map(pass => pass.integrated?.stateDigest)).toEqual(['0x01', '0x01']);
21
+ });
22
+ test.each([undefined, 2, 10000])('composition-only reports actual counts with limit %p', async (recordLimit) => {
23
+ const output = [];
24
+ const read = async ({ records }) => ({ records: Math.min(records ?? Infinity, 3), totalMs: 2, celMs: 0 });
25
+ const expected = recordLimit === 2 ? 2 : 3;
26
+ const report = await (0, benchmark_execution_1.executeBenchmark)({ directory: 'fixture', log: line => output.push(line) }, { project: 'fixture', recordLimit, warmupRecords: 1000, runs: 2, modes: ['read', 'cel'],
27
+ profileMode: 'cel', header: [] }, { read, project: read, cel: read });
28
+ expect(report.records).toEqual(expected);
29
+ expect(report.warmupRecords).toEqual(expected);
30
+ expect(report.passes.map(pass => [pass.loader.records, pass.integrated?.records])).toEqual([[expected, expected], [expected, expected]]);
31
+ expect(output).toEqual((0, benchmark_report_1.formatBenchmarkReport)(report));
32
+ });
33
+ test('CLI adapter omits unselected operations and publishes one JSON report', async () => {
34
+ const events = [], output = [];
35
+ const report = await (0, benchmark_execution_1.executeBenchmark)({ directory: 'fixture', json: true, log: line => output.push(line) }, { project: 'fixture', records: 3, warmupRecords: 0, runs: 2, modes: ['read'],
36
+ profileMode: 'cel', header: ['WORKLOAD fixture'] }, workloads(events));
37
+ expect(events).toEqual(['read:3:-', 'read:3:-']);
38
+ expect(output).toEqual([JSON.stringify(report, null, 2)]);
39
+ expect(report.passes.map(pass => [pass.projection, pass.integrated])).toEqual([[undefined, undefined], [undefined, undefined]]);
40
+ });
41
+ test('CLI adapter samples only measured CEL and emits diagnostic notes', async () => {
42
+ const events = [], output = [];
43
+ const operations = workloads(events);
44
+ const timing = { sampleEvery: 2, records: 3, samples: 1, generations: [{ index: 0, nodes: 2, nsPerSample: 3 }] };
45
+ const cel = async (context) => ({ ...await operations.cel(context),
46
+ ...(context.timingSampleEvery ? { graphTiming: timing } : {}) });
47
+ const report = await (0, benchmark_execution_1.executeBenchmark)({ directory: 'fixture', graphTiming: true, log: line => output.push(line) }, { project: 'fixture', records: 3, warmupRecords: 1, runs: 1, modes: ['read', 'cel'],
48
+ profileMode: 'cel', timingSampleEvery: 2, header: [] }, { ...operations, cel });
49
+ expect(events).toEqual(['read:1:-', 'cel:1:-', 'read:3:-', 'cel:3:2']);
50
+ expect(report.passes[0].integrated?.graphTiming).toEqual(timing);
51
+ expect(output).toEqual((0, benchmark_report_1.formatBenchmarkReport)(report));
52
+ expect(output.filter(line => /^(GRAPH TIMING|GENERATION)/.test(line))).toEqual([
53
+ 'GRAPH TIMING pass=1 sampled=1/3 every=2', 'GENERATION 1 nodes=2 ns/sample=3.0',
54
+ 'GRAPH TIMING NOTE: sampled diagnostic measurements include timing overhead and are not baseline throughput.'
55
+ ]);
56
+ });
57
+ test('CLI adapter stops on an invalid measured round without emitting a pass', async () => {
58
+ const events = [], output = [];
59
+ const operations = workloads(events);
60
+ await expect((0, benchmark_execution_1.executeBenchmark)({ directory: 'fixture', log: line => output.push(line) }, { project: 'fixture', records: 3, warmupRecords: 0, runs: 2, modes: ['read', 'cel'],
61
+ profileMode: 'cel', header: [] }, { ...operations, cel: async () => ({ records: 2, totalMs: 2, celMs: 1 }) }))
62
+ .rejects.toThrow(new Error('Benchmark record counts do not match'));
63
+ expect(events).toEqual(['read:3:-']);
64
+ expect(output.length).toEqual(3);
65
+ });
66
+ test('JSON output rejects inconsistent final states before publishing a report', async () => {
67
+ const output = [];
68
+ let index = 0;
69
+ await expect((0, benchmark_execution_1.executeBenchmark)({ directory: 'fixture', json: true, log: line => output.push(line) }, { project: 'fixture', records: 3, warmupRecords: 0, runs: 2, modes: ['read', 'cel'],
70
+ profileMode: 'cel', header: [] }, { ...workloads([]), cel: async () => ({ records: 3, totalMs: 2, celMs: 1, stateDigest: String(++index) }) }))
71
+ .rejects.toThrow(new Error('Stateful benchmark produced inconsistent final accumulator values across runs'));
72
+ expect(output).toEqual([]);
73
+ });
74
+ //# sourceMappingURL=benchmark.execution.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"benchmark.execution.spec.js","sourceRoot":"","sources":["../../src/benchmark.execution.spec.ts"],"names":[],"mappings":";;AAAA,+DAAsD;AAEtD,yDAAwD;AAExD,SAAS,SAAS,CAAC,MAAgB;IAC/B,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,EAAE,EAAC,OAAO,EAAE,iBAAiB,EAA4B,EAAE,EAAE;QAClG,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,OAAO,IAAI,iBAAiB,IAAI,GAAG,EAAE,CAAC,CAAA;QAC7D,OAAO,EAAC,OAAO,EAAE,OAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAChE,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,EAAC,WAAW,EAAE,MAAM,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAC,CAAA;IACzD,CAAC,CAAA;IACD,OAAO,EAAC,IAAI,E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C,OAAO,CAAC,EAAE,CAAC,CAAA;AAC9B,CAAC,CAAC,CAAA"}
@@ -0,0 +1,26 @@
1
+ import type { ProjectionAuthoring } from '@cobol-ts/cursor-loader-types';
2
+ export declare const FORMAT_PROJECTION: ProjectionAuthoring;
3
+ export declare const FORMAT_TYPES: readonly ["cobol", "csv", "jsonl", "protobuf", "indexed-graph-state"];
4
+ export type FormatType = typeof FORMAT_TYPES[number];
5
+ export type FormatBenchmarkName = `format-${FormatType}`;
6
+ export declare const FORMAT_BENCHMARKS: readonly FormatBenchmarkName[];
7
+ /** One input record per customer. Every second customer has historical state. */
8
+ export declare const FORMAT_HISTORICAL_VALUE = 100n;
9
+ /** A million-record fixture is bounded in memory; only the current output chunk is held. */
10
+ export declare function scalarRow(index: number): {
11
+ customerId: bigint;
12
+ amountA: bigint;
13
+ amountB: bigint;
14
+ statusCode: string;
15
+ };
16
+ export declare const FORMAT_COPYBOOK = " 01 BENCHMARK-RECORD.\n 05 CUSTOMER-ID PIC 9(10).\n 05 AMOUNT-A PIC 9(9).\n 05 AMOUNT-B PIC 9(9).\n 05 STATUS-CODE PIC X.\n 05 FILLER PIC X(171).\n";
17
+ /** Every node updates its customer's historical value, and each block of ten
18
+ * depends on a previously evaluated node in the same graph. */
19
+ export declare function formatGraphYaml(nodes?: 10 | 1000): string;
20
+ export declare function formatAccumulatorSchema(nodes: 10 | 1000): import("@cobol-ts/cursor-loader-indexed-graph-state").IndexedGraphSchema;
21
+ export declare function formatAccumulatorYaml(nodes: 10 | 1000): string;
22
+ export declare const FORMAT_SCHEMA: import("@cobol-ts/cursor-loader-indexed-graph-state").IndexedGraphSchema;
23
+ /** A self-describing message generated using the same persistent protobuf schema tool as state files. */
24
+ export declare function formatProtobufSchema(): import("@cobol-ts/cursor-loader-protobuf").AccumulatorSchema;
25
+ /** Local project structure is identical across formats except files.yaml and bytes on disk. */
26
+ export declare function generateFormatBenchmarkProject(base: string, name: FormatBenchmarkName, records?: number, force?: boolean, nodes?: 10 | 1000): Promise<string>;
@@ -0,0 +1,186 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FORMAT_SCHEMA = exports.FORMAT_COPYBOOK = exports.FORMAT_HISTORICAL_VALUE = exports.FORMAT_BENCHMARKS = exports.FORMAT_TYPES = exports.FORMAT_PROJECTION = void 0;
4
+ exports.scalarRow = scalarRow;
5
+ exports.formatGraphYaml = formatGraphYaml;
6
+ exports.formatAccumulatorSchema = formatAccumulatorSchema;
7
+ exports.formatAccumulatorYaml = formatAccumulatorYaml;
8
+ exports.formatProtobufSchema = formatProtobufSchema;
9
+ exports.generateFormatBenchmarkProject = generateFormatBenchmarkProject;
10
+ const cursor_loader_benchmark_1 = require("@cobol-ts/cursor-loader-benchmark");
11
+ /** The same deterministic scalar records, graph, and projection for five physical encodings. */
12
+ const files_node_1 = require("@cobol-ts/files-node");
13
+ const node_path_1 = require("node:path");
14
+ const protobuf_1 = require("@bufbuild/protobuf");
15
+ const errors_1 = require("@cobol-ts/errors");
16
+ const dependency_node_1 = require("@cobol-ts/dependency_node");
17
+ const cursor_loader_protobuf_1 = require("@cobol-ts/cursor-loader-protobuf");
18
+ const cursor_loader_protobuf_node_1 = require("@cobol-ts/cursor-loader-protobuf-node");
19
+ const cursor_loader_indexed_graph_state_1 = require("@cobol-ts/cursor-loader-indexed-graph-state");
20
+ const cursor_loader_indexed_graph_state_node_1 = require("@cobol-ts/cursor-loader-indexed-graph-state-node");
21
+ const { open, mkdir, stat, writeFile, rm } = files_node_1.nodeLocalFiles.promises;
22
+ exports.FORMAT_PROJECTION = {
23
+ customerId: { type: 'integer' }, amountA: { type: 'integer' }, amountB: { type: 'integer' }, statusCode: { type: 'string' }
24
+ };
25
+ exports.FORMAT_TYPES = ['cobol', 'csv', 'jsonl', 'protobuf', 'indexed-graph-state'];
26
+ exports.FORMAT_BENCHMARKS = exports.FORMAT_TYPES.map(t => `format-${t}`);
27
+ /** One input record per customer. Every second customer has historical state. */
28
+ exports.FORMAT_HISTORICAL_VALUE = 100n;
29
+ /** A million-record fixture is bounded in memory; only the current output chunk is held. */
30
+ function scalarRow(index) {
31
+ if (!Number.isSafeInteger(index) || index < 0)
32
+ throw new RangeError('Invalid scalar fixture index');
33
+ return {
34
+ customerId: BigInt(index + 1),
35
+ amountA: BigInt((index * 7) % 100_000_000),
36
+ amountB: BigInt((index * 13) % 100_000_000),
37
+ statusCode: index % 2 === 0 ? 'A' : 'B'
38
+ };
39
+ }
40
+ exports.FORMAT_COPYBOOK = ` 01 BENCHMARK-RECORD.\n 05 CUSTOMER-ID PIC 9(10).\n 05 AMOUNT-A PIC 9(9).\n 05 AMOUNT-B PIC 9(9).\n 05 STATUS-CODE PIC X.\n 05 FILLER PIC X(171).\n`;
41
+ /** Every node updates its customer's historical value, and each block of ten
42
+ * depends on a previously evaluated node in the same graph. */
43
+ function formatGraphYaml(nodes = 10) {
44
+ const lines = [];
45
+ for (let i = 0; i < nodes; i++) {
46
+ const self = `prev.node${String(i).padStart(4, '0')}`;
47
+ const preceding = i > 0 && i % 10 === 0
48
+ ? ` + (now.node${String(i - 1).padStart(4, '0')} > 0 ? 1 : 0)` : '';
49
+ const term = i % 10 === 0 ? 'input.amountA + input.amountB' :
50
+ i % 10 === 1 ? '(input.statusCode == "A" ? 1 : 0)' :
51
+ i % 10 === 2 ? 'input.amountA' :
52
+ i % 10 === 3 ? 'input.amountB' : '(input.customerId > 0 ? 1 : 0)';
53
+ lines.push(`node${String(i).padStart(4, '0')}:\n type: cel\n cel: ${JSON.stringify(self + ' + ' + term + preceding)}\n metadata:\n type: number\n celResultType: int\n javascriptType: bigint\n`);
54
+ }
55
+ return lines.join('');
56
+ }
57
+ function formatAccumulatorSchema(nodes) {
58
+ return (0, cursor_loader_indexed_graph_state_1.indexedGraphSchema)(Array.from({ length: nodes }, (_, i) => ({ name: `node${String(i).padStart(4, '0')}`, type: 'int' })));
59
+ }
60
+ function formatAccumulatorYaml(nodes) {
61
+ const lines = ['file: ../data/previous-state.igs', 'optional: false',
62
+ 'removed: reject', 'customerId:', ' field: customerId', ' type: number', 'initial:'];
63
+ for (let i = 0; i < nodes; i++)
64
+ lines.push(` node${String(i).padStart(4, '0')}: 0`);
65
+ return lines.join('\n') + '\n';
66
+ }
67
+ /** Even customers have state from a previous run; odd customers start from the pool.
68
+ * All historical values are nonzero, ensuring a missing/ignored history fails verification. */
69
+ async function writeHistoricalAccumulators(filename, records, nodes) {
70
+ function* previous() {
71
+ for (let customer = 2; customer <= records; customer += 2) {
72
+ const record = (0, cursor_loader_indexed_graph_state_1.createIndexedGraphRecord)(nodes);
73
+ record.customerId = BigInt(customer);
74
+ record.values.fill(exports.FORMAT_HISTORICAL_VALUE);
75
+ yield record;
76
+ }
77
+ }
78
+ await (0, cursor_loader_indexed_graph_state_node_1.writeIndexedGraphStateFile)(filename, formatAccumulatorSchema(nodes), previous());
79
+ }
80
+ exports.FORMAT_SCHEMA = (0, cursor_loader_indexed_graph_state_1.indexedGraphSchema)([
81
+ { name: 'amountA', type: 'int' }, { name: 'amountB', type: 'int' }, { name: 'statusCode', type: 'string' }
82
+ ]);
83
+ /** A self-describing message generated using the same persistent protobuf schema tool as state files. */
84
+ function formatProtobufSchema() {
85
+ const authoring = {
86
+ amountA: { type: 'cel', cel: '1', metadata: { type: 'number', celResultType: 'int' } },
87
+ amountB: { type: 'cel', cel: '1', metadata: { type: 'number', celResultType: 'int' } },
88
+ statusCode: { type: 'cel', cel: '"A"', metadata: { type: 'string', celResultType: 'string' } }
89
+ };
90
+ return (0, cursor_loader_protobuf_1.accumulatorSchemaFromGraph)((0, errors_1.valueOrThrow)((0, dependency_node_1.normalise)(authoring)));
91
+ }
92
+ async function writeTextRows(filename, format, records, force) {
93
+ const file = await open(filename, force ? 'w' : 'wx');
94
+ try {
95
+ if (format === 'csv')
96
+ await file.writeFile('customerId,amountA,amountB,statusCode\n');
97
+ const CHUNK = 5000;
98
+ for (let from = 0; from < records; from += CHUNK) {
99
+ const lines = [];
100
+ for (let i = from; i < Math.min(records, from + CHUNK); i++) {
101
+ const r = scalarRow(i);
102
+ if (format === 'csv')
103
+ lines.push(`${r.customerId},${r.amountA},${r.amountB},${r.statusCode}\n`);
104
+ else if (format === 'jsonl')
105
+ lines.push(JSON.stringify({ customerId: Number(r.customerId),
106
+ amountA: Number(r.amountA), amountB: Number(r.amountB), statusCode: r.statusCode }) + '\n');
107
+ else
108
+ lines.push(String(r.customerId).padStart(10, '0') +
109
+ String(r.amountA).padStart(9, '0') + String(r.amountB).padStart(9, '0') +
110
+ r.statusCode + ' '.repeat(171));
111
+ }
112
+ await file.writeFile(lines.join(''));
113
+ }
114
+ }
115
+ finally {
116
+ await file.close();
117
+ }
118
+ }
119
+ async function writeFormatData(filename, format, records, force) {
120
+ if (format === 'cobol' || format === 'csv' || format === 'jsonl')
121
+ return writeTextRows(filename, format, records, force);
122
+ if (format === 'protobuf') {
123
+ const schema = formatProtobufSchema();
124
+ function* rows() {
125
+ for (let i = 0; i < records; i++)
126
+ yield (0, protobuf_1.create)(schema.message, scalarRow(i));
127
+ }
128
+ return (0, cursor_loader_protobuf_node_1.writeAccumulatorFile)(filename, schema, rows());
129
+ }
130
+ function* rows() {
131
+ for (let i = 0; i < records; i++) {
132
+ const row = scalarRow(i);
133
+ const record = (0, cursor_loader_indexed_graph_state_1.createIndexedGraphRecord)(3);
134
+ record.customerId = row.customerId;
135
+ record.values[0] = row.amountA;
136
+ record.values[1] = row.amountB;
137
+ record.values[2] = row.statusCode;
138
+ yield record;
139
+ }
140
+ }
141
+ return (0, cursor_loader_indexed_graph_state_node_1.writeIndexedGraphStateFile)(filename, exports.FORMAT_SCHEMA, rows());
142
+ }
143
+ const FORMAT_FILENAMES = {
144
+ cobol: 'records.dat', csv: 'records.csv', jsonl: 'records.jsonl',
145
+ protobuf: 'records.pb', 'indexed-graph-state': 'records.igs'
146
+ };
147
+ /** Local project structure is identical across formats except files.yaml and bytes on disk. */
148
+ async function generateFormatBenchmarkProject(base, name, records = 10_000, force = false, nodes = 10) {
149
+ const type = name.slice('format-'.length);
150
+ if (!exports.FORMAT_TYPES.includes(type))
151
+ throw new Error(`Unknown format benchmark ${name}`);
152
+ if (!Number.isSafeInteger(records) || records < 1)
153
+ throw new RangeError('records must be positive');
154
+ if (nodes !== 10 && nodes !== 1000)
155
+ throw new RangeError('format graph size must be 10 or 1000');
156
+ const destination = (0, node_path_1.resolve)(base, name);
157
+ if (!force) {
158
+ try {
159
+ await stat(destination);
160
+ throw new Error(`Benchmark project already exists: ${destination}`);
161
+ }
162
+ catch (error) {
163
+ if (!error || typeof error !== 'object' || !('code' in error) || error.code !== 'ENOENT')
164
+ throw error;
165
+ }
166
+ }
167
+ const config = (0, node_path_1.join)(destination, '.cobolts'), data = (0, node_path_1.join)(destination, 'data'), copybooks = (0, node_path_1.join)(destination, 'copybooks');
168
+ await Promise.all([mkdir(config, { recursive: true }), mkdir(data, { recursive: true }), mkdir(copybooks, { recursive: true })]);
169
+ const put = (file, content) => writeFile(file, content, { flag: force ? 'w' : 'wx' });
170
+ await put((0, node_path_1.join)(destination, '.gitignore'), '*\n!.gitignore\n');
171
+ await put((0, node_path_1.join)(copybooks, 'format.cbl'), exports.FORMAT_COPYBOOK);
172
+ const options = type === 'cobol'
173
+ ? ' copybook: format.cbl\n options:\n framing:\n kind: fixed\n recordLength: 200\n' : '';
174
+ await put((0, node_path_1.join)(config, 'files.yaml'), `root: ../copybooks\nentities:\n - customer\nfiles:\n records:\n type: ${type}\n key: customer\n keyPath: customerId\n${options}${type === 'cobol' ? '' : ' projection:\n customerId: {type: integer}\n amountA: {type: integer}\n amountB: {type: integer}\n statusCode: {type: string}\n'}${cursor_loader_benchmark_1.benchmarkReferenceFile}mappings: {}\ncompositions:\n benchmark:\n type: relational\n periodicity: daily\n master: records\n files:\n records: one\n${cursor_loader_benchmark_1.benchmarkReferenceMembership} monthly:\n type: relational\n periodicity: monthly\n master: records\n files:\n records: one\n${cursor_loader_benchmark_1.benchmarkReferenceMembership}`);
175
+ await put((0, node_path_1.join)(config, 'data.yaml'), `root: ../data\nfiles:\n records: ${FORMAT_FILENAMES[type]}\n sicCodes: sicCodes.csv\n`);
176
+ await put((0, node_path_1.join)(data, 'sicCodes.csv'), cursor_loader_benchmark_1.benchmarkReferenceCsv);
177
+ await put((0, node_path_1.join)(config, 'benchmark.yaml'), `version: 1\ncomposition: benchmark\nfile: records\nformatComparison: ${type}\nencoding: ascii\nrecords: ${records}\nwarmup: 10000\nruns: 3\nfields:\n - customerId\n - amountA\n - amountB\n - statusCode\ngraph: graph.yaml\n`);
178
+ if (force)
179
+ await rm((0, node_path_1.join)(config, 'benchmark.graph.yaml'), { force: true });
180
+ await put((0, node_path_1.join)(config, 'graph.yaml'), formatGraphYaml(nodes).replace(/\binput\./g, 'input.records.'));
181
+ await put((0, node_path_1.join)(config, 'accumulator.yaml'), formatAccumulatorYaml(nodes));
182
+ await writeFormatData((0, node_path_1.join)(data, FORMAT_FILENAMES[type]), type, records, force);
183
+ await writeHistoricalAccumulators((0, node_path_1.join)(data, 'previous-state.igs'), records, nodes);
184
+ return destination;
185
+ }
186
+ //# sourceMappingURL=benchmark.format.fixture.js.map