@@ -87,12 +87,6 @@ type WorkerLaunchRuntime = {
8787 spawnWorker ?: BenchmarkWorkerSpawner ;
8888} ;
8989
90- type BenchmarkRuntime = {
91- runWorker ?: typeof runWorker ;
92- writeProgress ?: ( line : string ) => void ;
93- now ?: ( ) => number ;
94- } ;
95-
9690function usage ( ) : string {
9791 return `OpenClaw durable task registry churn benchmark
9892
@@ -330,23 +324,6 @@ function parseWorkerProcessResult(
330324 } ) ;
331325}
332326
333- function buildWorkerArgs ( options : Options , size : number , stateDir : string ) : string [ ] {
334- return [
335- "--expose-gc" ,
336- "--import" ,
337- "tsx" ,
338- "scripts/bench-task-registry-sqlite-worker.ts" ,
339- "--size" ,
340- String ( size ) ,
341- "--cycles" ,
342- String ( options . cycles ) ,
343- "--warmup" ,
344- String ( options . warmup ) ,
345- "--state-dir" ,
346- stateDir ,
347- ] ;
348- }
349-
350327function runWorker (
351328 options : Options ,
352329 size : number ,
@@ -355,7 +332,20 @@ function runWorker(
355332 const stateDir = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , "openclaw-task-registry-bench-" ) ) ;
356333 try {
357334 return runBenchmarkWorker ( {
358- args : buildWorkerArgs ( options , size , stateDir ) ,
335+ args : [
336+ "--expose-gc" ,
337+ "--import" ,
338+ "tsx" ,
339+ "scripts/bench-task-registry-sqlite-worker.ts" ,
340+ "--size" ,
341+ String ( size ) ,
342+ "--cycles" ,
343+ String ( options . cycles ) ,
344+ "--warmup" ,
345+ String ( options . warmup ) ,
346+ "--state-dir" ,
347+ stateDir ,
348+ ] ,
359349 label : `size ${ size } ` ,
360350 sentinel : WORKER_RESULT_SENTINEL ,
361351 spawnWorker : runtime . spawnWorker ,
@@ -441,14 +431,11 @@ function aggregateWorkerResults(options: Options, workers: WorkerResult[]) {
441431 } ;
442432}
443433
444- function benchmark ( options : Options , runtime : BenchmarkRuntime = { } ) {
445- const run = runtime . runWorker ?? runWorker ;
434+ function benchmark ( options : Options ) {
446435 const workers = runBenchmarkJobs ( options . sizes , {
447436 prefix : "bench-task-registry-sqlite" ,
448437 describe : ( size ) => `size=${ size } ` ,
449- run : ( size ) => run ( options , size ) ,
450- now : runtime . now ,
451- writeProgress : runtime . writeProgress ,
438+ run : ( size ) => runWorker ( options , size ) ,
452439 } ) ;
453440 return aggregateWorkerResults ( options , workers ) ;
454441}
@@ -473,12 +460,9 @@ async function main(argv = process.argv.slice(2)): Promise<void> {
473460
474461export const testing = {
475462 aggregateWorkerResults,
476- benchmark,
477- buildWorkerArgs,
478463 parseOptions,
479464 parseWorkerProcessResult,
480465 runWorker,
481- summarizeTimings : summarizeBenchmarkTimings ,
482466} ;
483467
484468if ( import . meta. url === pathToFileURL ( process . argv [ 1 ] ?? "" ) . href ) {
0 commit comments