@@ -88,30 +88,31 @@ async function runBenchmarkSuite(suite: Suite, runner: VitestRunner) {
88
88
} )
89
89
} )
90
90
91
- Promise . all ( benchmarkGroup . map ( async ( benchmark ) => {
91
+ const tasks : BenchTask [ ] = [ ]
92
+ for ( const benchmark of benchmarkGroup ) {
92
93
await benchmark . meta . task ! . warmup ( )
93
94
const { setTimeout } = getSafeTimers ( )
94
- return await new Promise < BenchTask > ( resolve => setTimeout ( async ( ) => {
95
+ tasks . push ( await new Promise < BenchTask > ( resolve => setTimeout ( async ( ) => {
95
96
resolve ( await benchmark . meta . task ! . run ( ) )
96
- } ) )
97
- } ) ) . then ( ( tasks ) => {
98
- suite . result ! . duration = performance . now ( ) - start
99
- suite . result ! . state = 'pass'
100
-
101
- tasks
102
- . sort ( ( a , b ) => a . result ! . mean - b . result ! . mean )
103
- . forEach ( ( cycle , idx ) => {
104
- const benchmark = benchmarkMap [ cycle . name || '' ]
105
- benchmark . result ! . state = 'pass'
106
- if ( benchmark ) {
107
- const result = benchmark . result ! . benchmark !
108
- result . rank = Number ( idx ) + 1
109
- updateTask ( benchmark )
110
- }
111
- } )
112
- updateTask ( suite )
113
- defer . resolve ( null )
114
- } )
97
+ } ) ) )
98
+ }
99
+
100
+ suite . result ! . duration = performance . now ( ) - start
101
+ suite . result ! . state = 'pass'
102
+
103
+ tasks
104
+ . sort ( ( a , b ) => a . result ! . mean - b . result ! . mean )
105
+ . forEach ( ( cycle , idx ) => {
106
+ const benchmark = benchmarkMap [ cycle . name || '' ]
107
+ benchmark . result ! . state = 'pass'
108
+ if ( benchmark ) {
109
+ const result = benchmark . result ! . benchmark !
110
+ result . rank = Number ( idx ) + 1
111
+ updateTask ( benchmark )
112
+ }
113
+ } )
114
+ updateTask ( suite )
115
+ defer . resolve ( null )
115
116
116
117
await defer
117
118
}
0 commit comments