@@ -8,52 +8,53 @@ const bench = common.createBenchmark(main, {
88process.maxTickDepth = Infinity;
99
1010function main({ n }) {
11+ let counter = n;
1112 function cb4(arg1, arg2, arg3, arg4) {
12- if (--n ) {
13- if (n % 4 === 0)
13+ if (--counter ) {
14+ if (counter % 4 === 0)
1415 process.nextTick(cb4, 3.14, 1024, true, false);
15- else if (n % 3 === 0)
16+ else if (counter % 3 === 0)
1617 process.nextTick(cb3, 512, true, null);
17- else if (n % 2 === 0)
18+ else if (counter % 2 === 0)
1819 process.nextTick(cb2, false, 5.1);
1920 else
2021 process.nextTick(cb1, 0);
2122 } else
2223 bench.end(n);
2324 }
2425 function cb3(arg1, arg2, arg3) {
25- if (--n ) {
26- if (n % 4 === 0)
26+ if (--counter ) {
27+ if (counter % 4 === 0)
2728 process.nextTick(cb4, 3.14, 1024, true, false);
28- else if (n % 3 === 0)
29+ else if (counter % 3 === 0)
2930 process.nextTick(cb3, 512, true, null);
30- else if (n % 2 === 0)
31+ else if (counter % 2 === 0)
3132 process.nextTick(cb2, false, 5.1);
3233 else
3334 process.nextTick(cb1, 0);
3435 } else
3536 bench.end(n);
3637 }
3738 function cb2(arg1, arg2) {
38- if (--n ) {
39- if (n % 4 === 0)
39+ if (--counter ) {
40+ if (counter % 4 === 0)
4041 process.nextTick(cb4, 3.14, 1024, true, false);
41- else if (n % 3 === 0)
42+ else if (counter % 3 === 0)
4243 process.nextTick(cb3, 512, true, null);
43- else if (n % 2 === 0)
44+ else if (counter % 2 === 0)
4445 process.nextTick(cb2, false, 5.1);
4546 else
4647 process.nextTick(cb1, 0);
4748 } else
4849 bench.end(n);
4950 }
5051 function cb1(arg1) {
51- if (--n ) {
52- if (n % 4 === 0)
52+ if (--counter ) {
53+ if (counter % 4 === 0)
5354 process.nextTick(cb4, 3.14, 1024, true, false);
54- else if (n % 3 === 0)
55+ else if (counter % 3 === 0)
5556 process.nextTick(cb3, 512, true, null);
56- else if (n % 2 === 0)
57+ else if (counter % 2 === 0)
5758 process.nextTick(cb2, false, 5.1);
5859 else
5960 process.nextTick(cb1, 0);
0 commit comments