feat(engine): expose canonical replay sessions through native workers
This commit is contained in:
parent
417a7bd21e
commit
e3635f23cf
26 changed files with 2693 additions and 33 deletions
|
|
@ -1,8 +1,10 @@
|
|||
/**
|
||||
* Existing one-shot native path only; no DB, broker, queue or strategy callbacks.
|
||||
* Existing one-shot native path by default; no DB, broker or durable queue.
|
||||
* bun run scripts/benchmark-research.ts # tiny deterministic self-test
|
||||
* bun run scripts/benchmark-research.ts --measure # 1k/10k total bars, 1/10 assets
|
||||
* bun run scripts/benchmark-research.ts --measure --large # additionally 100k (quadratic queue)
|
||||
* bun run scripts/benchmark-research.ts --session # canonical pull-session self-test
|
||||
* bun run scripts/benchmark-research.ts --session --measure # 1k/10k bars, actual TS decisions
|
||||
* Build workspace libraries/config and the local engine first. JSON stdout; diagnostics stderr.
|
||||
*/
|
||||
import { createHash } from 'node:crypto';
|
||||
|
|
@ -335,19 +337,37 @@ export function verifyRepeats(
|
|||
}
|
||||
|
||||
async function main(args: string[]) {
|
||||
if (args[0] === '--session-child') {
|
||||
const { sessionChild } = await import('./benchmark-replay');
|
||||
process.stdout.write(JSON.stringify(await sessionChild(JSON.parse(args[1] ?? ''))) + '\n');
|
||||
return;
|
||||
}
|
||||
if (args[0] === '--child') {
|
||||
process.stdout.write(JSON.stringify(await child(JSON.parse(args[1] ?? ''))) + '\n');
|
||||
return;
|
||||
}
|
||||
if (
|
||||
args.some(a => !['--self-test', '--measure', '--large'].includes(a)) ||
|
||||
args.some(a => !['--self-test', '--measure', '--large', '--session'].includes(a)) ||
|
||||
(args.includes('--large') && !args.includes('--measure')) ||
|
||||
(args.includes('--self-test') && args.includes('--measure'))
|
||||
) {
|
||||
throw new Error('Use no flags/--self-test, --measure, or --measure --large');
|
||||
throw new Error(
|
||||
'Use no flags/--self-test, --measure, or --measure --large; optionally --session'
|
||||
);
|
||||
}
|
||||
const metadata = identity(); // Excluded from workload timings.
|
||||
const measured = args.includes('--measure');
|
||||
if (args.includes('--session')) {
|
||||
const { sessionBenchmark } = await import('./benchmark-replay');
|
||||
await sessionBenchmark(
|
||||
root,
|
||||
fileURLToPath(import.meta.url),
|
||||
metadata,
|
||||
measured,
|
||||
args.includes('--large')
|
||||
);
|
||||
return;
|
||||
}
|
||||
const workloads = measured
|
||||
? (args.includes('--large') ? [1000, 10_000, 100_000] : [1000, 10_000]).flatMap(totalBars =>
|
||||
[1, 10].map(assets => ({ totalBars, assets, seed: 42 }))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue