@@ -258,9 +258,15 @@ function benchmarkResolve(): BenchmarkResult {
258258const outDir = resolve ( import . meta. dirname ?? '.' , '.' ) ;
259259
260260function runBenchmark ( input : ProcGenConfig , output : BenchmarkResult [ ] ) {
261- Object . assign ( config , { samples : ( input . samples ?? SAMPLES ) * 2 } , input ) ;
261+ Object . assign ( config , { samples : input . samples ?? SAMPLES } , input ) ;
262262 branchingUnrollArray = getArrayForUnroll ( config . branching ) ;
263263
264+ // warmup
265+ for ( let i = 0 ; i < config . samples ; i ++ ) {
266+ rand = splitmix32 ( config . seed ) ;
267+ const _ = benchmarkResolve ( ) ;
268+ }
269+
264270 for ( let i = 0 ; i < config . samples ; i ++ ) {
265271 rand = splitmix32 ( config . seed ) ;
266272 const result = benchmarkResolve ( ) ;
@@ -289,10 +295,7 @@ for (const depth of DEPTHS) {
289295 results ,
290296 ) ;
291297}
292- writeFileSync (
293- resolve ( outDir , 'results-max-depth.json' ) ,
294- JSON . stringify ( results . slice ( Math . floor ( results . length / 2 ) , results . length ) , null , 2 ) ,
295- ) ;
298+ writeFileSync ( resolve ( outDir , 'results-max-depth.json' ) , JSON . stringify ( results , null , 2 ) ) ;
296299results . length = 0 ;
297300
298301// resolution time vs linear recursion (path)
@@ -308,10 +311,7 @@ for (const depth of DEPTHS) {
308311 results ,
309312 ) ;
310313}
311- writeFileSync (
312- resolve ( outDir , 'results-linear-recursion.json' ) ,
313- JSON . stringify ( results . slice ( Math . floor ( results . length / 2 ) , results . length ) , null , 2 ) ,
314- ) ;
314+ writeFileSync ( resolve ( outDir , 'results-linear-recursion.json' ) , JSON . stringify ( results , null , 2 ) ) ;
315315results . length = 0 ;
316316
317317// resolution time vs random
@@ -327,8 +327,5 @@ for (const depth of DEPTHS) {
327327 results ,
328328 ) ;
329329}
330- writeFileSync (
331- resolve ( outDir , 'results-random.json' ) ,
332- JSON . stringify ( results . slice ( Math . floor ( results . length / 2 ) , results . length ) , null , 2 ) ,
333- ) ;
330+ writeFileSync ( resolve ( outDir , 'results-random.json' ) , JSON . stringify ( results , null , 2 ) ) ;
334331results . length = 0 ;
0 commit comments