@@ -60,16 +60,18 @@ async function runCPUBenchmark(
6060
6161 console . log ( "benchmarking" , framework , benchmark . benchmarkInfo . id ) ;
6262 let browser : Browser = null ;
63- let page : Page = null ;
63+ // let page: Page = null;
6464 try {
6565 browser = await startBrowser ( benchmarkOptions ) ;
66- page = await browser . newPage ( ) ;
66+ // page = await browser.newPage();
6767 // if (config.LOG_DETAILS) {
68- page . on ( "console" , ( msg ) => {
69- for ( let i = 0 ; i < msg . args ( ) . length ; ++ i ) console . log ( `BROWSER: ${ msg . args ( ) [ i ] } ` ) ;
70- } ) ;
68+ // page.on("console", (msg) => {
69+ // for (let i = 0; i < msg.args().length; ++i) console.log(`BROWSER: ${msg.args()[i]}`);
70+ // });
7171 // }
7272 for ( let i = 0 ; i < benchmarkOptions . batchSize ; i ++ ) {
73+ const page = await browser . newPage ( ) ;
74+ page . on ( "console" , ( msg ) => console . log ( 'BROWSER:' , ...msg . args ( ) ) ) ;
7375 try {
7476 await page . goto ( `http://${ benchmarkOptions . host } :${ benchmarkOptions . port } /${ framework . uri } /index.html` , {
7577 waitUntil : "networkidle0" ,
@@ -120,12 +122,13 @@ async function runCPUBenchmark(
120122 screenshots : false ,
121123 categories : categories ,
122124 } ) ;
125+ await wait ( 50 ) ;
123126 await forceGC ( page , client ) ;
124127 console . log ( "runBenchmark" ) ;
125128 let m1 = await page . metrics ( ) ;
126129 await runBenchmark ( page , benchmark , framework ) ;
127130
128- await wait ( 40 ) ;
131+ await wait ( 50 ) ;
129132 await page . tracing . stop ( ) ;
130133 let m2 = await page . metrics ( ) ;
131134 if ( throttleCPU ) {
@@ -142,6 +145,7 @@ async function runCPUBenchmark(
142145 ) ;
143146 console . log ( "**** resultScript =" , resultScript ) ;
144147 if ( m2 . Timestamp == m1 . Timestamp ) throw new Error ( "Page metrics timestamp didn't change" ) ;
148+ await page . close ( ) ;
145149 results . push ( { total : result . duration , script : resultScript } ) ;
146150 console . log ( `duration for ${ framework . name } and ${ benchmark . benchmarkInfo . id } : ${ JSON . stringify ( result ) } ` ) ;
147151 if ( result . duration < 0 ) throw new Error ( `duration ${ result } < 0` ) ;
0 commit comments