@@ -13,7 +13,10 @@ export interface BenchmarkResult {
1313
1414export const benchmarkResults : BenchmarkResult [ ] = [ ] ;
1515
16- type ParseExpressionFn = ( expression : string , options ?: { currentDate ?: Date } ) => { next : ( ) => any } ;
16+ type ParseExpressionFn = (
17+ expression : string ,
18+ options ?: { currentDate ?: Date ; hashSeed : string } ,
19+ ) => { next : ( ) => any } ;
1720
1821let oldParseExpression : ParseExpressionFn ;
1922const newParseExpression = CronExpressionParser . parse as ParseExpressionFn ;
@@ -174,7 +177,7 @@ function runBenchmark(
174177 iterations : number ,
175178) : [ number , string [ ] ] {
176179 const start = performance . now ( ) ;
177- const result = parser ( expression , { currentDate } ) ;
180+ const result = parser ( expression , { currentDate, hashSeed : 'seed' } ) ;
178181 const dates : string [ ] = [ ] ;
179182 for ( let i = 0 ; i < iterations ; i ++ ) {
180183 dates . push ( result . next ( ) . toString ( ) ) ;
@@ -197,8 +200,8 @@ export async function parseAndBenchMarkExpression(
197200 console . log ( `running ${ samples } samples of ${ iterations } iterations each\n` ) ;
198201
199202 // Warm up run
200- runBenchmark ( expression , currentDate , oldParseExpression , Math . min ( 1000 , iterations ) ) ;
201- runBenchmark ( expression , currentDate , newParseExpression , Math . min ( 1000 , iterations ) ) ;
203+ runBenchmark ( expression , currentDate , oldParseExpression , 1 ) ;
204+ runBenchmark ( expression , currentDate , newParseExpression , 1 ) ;
202205
203206 // Actual benchmark runs
204207 for ( let i = 0 ; i < samples ; i ++ ) {
0 commit comments