File tree Expand file tree Collapse file tree
benchmark/cases/prefix-source Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,15 +29,19 @@ export default function register(bench) {
2929
3030 bench . add ( "prefix-source: getPrefix()" , ( ) => {
3131 const ps = new sources . PrefixSource ( "\t" , fixtureCode ) ;
32- for ( let i = 0 ; i < 500 ; i ++ ) ps . getPrefix ( ) ;
32+ let sink = 0 ;
33+ for ( let i = 0 ; i < 50_000 ; i ++ ) sink ^= ps . getPrefix ( ) . length ;
34+ if ( sink === - 1 ) throw new Error ( "unreachable" ) ;
3335 } ) ;
3436
3537 bench . add ( "prefix-source: original()" , ( ) => {
3638 const ps = new sources . PrefixSource (
3739 "\t" ,
3840 new sources . RawSource ( fixtureCode ) ,
3941 ) ;
40- for ( let i = 0 ; i < 500 ; i ++ ) ps . original ( ) ;
42+ let sink = 0 ;
43+ for ( let i = 0 ; i < 50_000 ; i ++ ) sink ^= ps . original ( ) === ps ? 1 : 0 ;
44+ if ( sink === - 1 ) throw new Error ( "unreachable" ) ;
4145 } ) ;
4246
4347 bench . add ( "prefix-source: source() (RawSource child)" , ( ) => {
You can’t perform that action at this time.
0 commit comments