Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup: add next-tick-depth-args fix
  • Loading branch information
apapirovski committed May 2, 2018
commit 32490e5eec5a17fbb2ab640d9b94fdcd48038472
33 changes: 17 additions & 16 deletions benchmark/process/next-tick-depth-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,52 +8,53 @@ const bench = common.createBenchmark(main, {
process.maxTickDepth = Infinity;

function main({ n }) {
let counter = n;
function cb4(arg1, arg2, arg3, arg4) {
if (--n) {
if (n % 4 === 0)
if (--counter) {
if (counter % 4 === 0)
process.nextTick(cb4, 3.14, 1024, true, false);
else if (n % 3 === 0)
else if (counter % 3 === 0)
process.nextTick(cb3, 512, true, null);
else if (n % 2 === 0)
else if (counter % 2 === 0)
process.nextTick(cb2, false, 5.1);
else
process.nextTick(cb1, 0);
} else
bench.end(n);
}
function cb3(arg1, arg2, arg3) {
if (--n) {
if (n % 4 === 0)
if (--counter) {
if (counter % 4 === 0)
process.nextTick(cb4, 3.14, 1024, true, false);
else if (n % 3 === 0)
else if (counter % 3 === 0)
process.nextTick(cb3, 512, true, null);
else if (n % 2 === 0)
else if (counter % 2 === 0)
process.nextTick(cb2, false, 5.1);
else
process.nextTick(cb1, 0);
} else
bench.end(n);
}
function cb2(arg1, arg2) {
if (--n) {
if (n % 4 === 0)
if (--counter) {
if (counter % 4 === 0)
process.nextTick(cb4, 3.14, 1024, true, false);
else if (n % 3 === 0)
else if (counter % 3 === 0)
process.nextTick(cb3, 512, true, null);
else if (n % 2 === 0)
else if (counter % 2 === 0)
process.nextTick(cb2, false, 5.1);
else
process.nextTick(cb1, 0);
} else
bench.end(n);
}
function cb1(arg1) {
if (--n) {
if (n % 4 === 0)
if (--counter) {
if (counter % 4 === 0)
process.nextTick(cb4, 3.14, 1024, true, false);
else if (n % 3 === 0)
else if (counter % 3 === 0)
process.nextTick(cb3, 512, true, null);
else if (n % 2 === 0)
else if (counter % 2 === 0)
process.nextTick(cb2, false, 5.1);
else
process.nextTick(cb1, 0);
Expand Down