Skip to content

Commit 55af327

Browse files
apapirovskiMylesBorins
authored andcommitted
benchmark: track exec time in next-tick-exec
The next-tick-exec benchmarks were meant to track nextTick execution time but due to an error, they actually track addition and execution. PR-URL: #20462 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent cfb2f34 commit 55af327

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

‎benchmark/process/next-tick-exec-args.js‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ const bench = common.createBenchmark(main, {
55
});
66

77
functionmain({ n }){
8+
functiononNextTick(i){
9+
if(i+1===n)
10+
bench.end(n);
11+
}
812

9-
bench.start();
1013
for(vari=0;i<n;i++){
1114
if(i%4===0)
1215
process.nextTick(onNextTick,i,true,10,'test');
@@ -17,8 +20,6 @@ function main({ n }) {
1720
else
1821
process.nextTick(onNextTick,i);
1922
}
20-
functiononNextTick(i){
21-
if(i+1===n)
22-
bench.end(n);
23-
}
23+
24+
bench.start();
2425
}

‎benchmark/process/next-tick-exec.js‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ const bench = common.createBenchmark(main, {
55
});
66

77
functionmain({ n }){
8-
9-
bench.start();
10-
for(vari=0;i<n;i++){
11-
process.nextTick(onNextTick,i);
12-
}
138
functiononNextTick(i){
149
if(i+1===n)
1510
bench.end(n);
1611
}
12+
13+
for(vari=0;i<n;i++){
14+
process.nextTick(onNextTick,i);
15+
}
16+
17+
bench.start();
1718
}

0 commit comments

Comments
 (0)