File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -259,7 +259,7 @@ class Suite {
259259 }
260260
261261 // It doesn't make sense to warmup a fresh new instance of Worker.
262- // TODO: support warmup directly in the Worker.
262+ // TODO: Should this be folded into the main loop?
263263 if ( ! this . #useWorkers) {
264264 // This is required to avoid variance on first benchmark run
265265 for ( let i = 0 ; i < this . #benchmarks. length ; ++ i ) {
Original file line number Diff line number Diff line change 11const { parentPort } = require ( "node:worker_threads" ) ;
2- const { runBenchmark } = require ( "./lifecycle" ) ;
2+ const {
3+ runBenchmark,
4+ getInitialIterations,
5+ runWarmup,
6+ } = require ( "./lifecycle" ) ;
7+ const { debugBench } = require ( "./clock" ) ;
38const AsyncFunction = Object . getPrototypeOf ( async ( ) => { } ) . constructor ;
49
510// Deserialize the benchmark function
@@ -24,6 +29,16 @@ parentPort.on(
2429 minSamples,
2530 } ) => {
2631 deserializeBenchmark ( benchmark ) ;
32+
33+ debugBench (
34+ `Warmup ${ benchmark . name } with minTime=${ benchmark . minTime } , maxTime=${ benchmark . maxTime } ` ,
35+ ) ;
36+ const initialIteration = await getInitialIterations ( benchmark ) ;
37+ await runWarmup ( benchmark , initialIteration , {
38+ minTime : 0.005 ,
39+ maxTime : 0.05 ,
40+ } ) ;
41+
2742 const result = await runBenchmark (
2843 benchmark ,
2944 initialIterations ,
You can’t perform that action at this time.
0 commit comments