@@ -8,52 +8,53 @@ const bench = common.createBenchmark(main, {
8
8
process . maxTickDepth = Infinity ;
9
9
10
10
function main ( { n } ) {
11
+ let counter = n ;
11
12
function cb4 ( arg1 , arg2 , arg3 , arg4 ) {
12
- if ( -- n ) {
13
- if ( n % 4 === 0 )
13
+ if ( -- counter ) {
14
+ if ( counter % 4 === 0 )
14
15
process . nextTick ( cb4 , 3.14 , 1024 , true , false ) ;
15
- else if ( n % 3 === 0 )
16
+ else if ( counter % 3 === 0 )
16
17
process . nextTick ( cb3 , 512 , true , null ) ;
17
- else if ( n % 2 === 0 )
18
+ else if ( counter % 2 === 0 )
18
19
process . nextTick ( cb2 , false , 5.1 ) ;
19
20
else
20
21
process . nextTick ( cb1 , 0 ) ;
21
22
} else
22
23
bench . end ( n ) ;
23
24
}
24
25
function cb3 ( arg1 , arg2 , arg3 ) {
25
- if ( -- n ) {
26
- if ( n % 4 === 0 )
26
+ if ( -- counter ) {
27
+ if ( counter % 4 === 0 )
27
28
process . nextTick ( cb4 , 3.14 , 1024 , true , false ) ;
28
- else if ( n % 3 === 0 )
29
+ else if ( counter % 3 === 0 )
29
30
process . nextTick ( cb3 , 512 , true , null ) ;
30
- else if ( n % 2 === 0 )
31
+ else if ( counter % 2 === 0 )
31
32
process . nextTick ( cb2 , false , 5.1 ) ;
32
33
else
33
34
process . nextTick ( cb1 , 0 ) ;
34
35
} else
35
36
bench . end ( n ) ;
36
37
}
37
38
function cb2 ( arg1 , arg2 ) {
38
- if ( -- n ) {
39
- if ( n % 4 === 0 )
39
+ if ( -- counter ) {
40
+ if ( counter % 4 === 0 )
40
41
process . nextTick ( cb4 , 3.14 , 1024 , true , false ) ;
41
- else if ( n % 3 === 0 )
42
+ else if ( counter % 3 === 0 )
42
43
process . nextTick ( cb3 , 512 , true , null ) ;
43
- else if ( n % 2 === 0 )
44
+ else if ( counter % 2 === 0 )
44
45
process . nextTick ( cb2 , false , 5.1 ) ;
45
46
else
46
47
process . nextTick ( cb1 , 0 ) ;
47
48
} else
48
49
bench . end ( n ) ;
49
50
}
50
51
function cb1 ( arg1 ) {
51
- if ( -- n ) {
52
- if ( n % 4 === 0 )
52
+ if ( -- counter ) {
53
+ if ( counter % 4 === 0 )
53
54
process . nextTick ( cb4 , 3.14 , 1024 , true , false ) ;
54
- else if ( n % 3 === 0 )
55
+ else if ( counter % 3 === 0 )
55
56
process . nextTick ( cb3 , 512 , true , null ) ;
56
- else if ( n % 2 === 0 )
57
+ else if ( counter % 2 === 0 )
57
58
process . nextTick ( cb2 , false , 5.1 ) ;
58
59
else
59
60
process . nextTick ( cb1 , 0 ) ;
0 commit comments