summaryrefslogtreecommitdiff
path: root/benchmark/timers/set-immediate-breadth-args.js
diff options
context:
space:
mode:
Diffstat (limited to 'benchmark/timers/set-immediate-breadth-args.js')
-rw-r--r--benchmark/timers/set-immediate-breadth-args.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/benchmark/timers/set-immediate-breadth-args.js b/benchmark/timers/set-immediate-breadth-args.js
new file mode 100644
index 0000000000..6a904e2675
--- /dev/null
+++ b/benchmark/timers/set-immediate-breadth-args.js
@@ -0,0 +1,28 @@
+'use strict';
+
+const common = require('../common.js');
+const bench = common.createBenchmark(main, {
+ millions: [5]
+});
+
+function main(conf) {
+ const N = +conf.millions * 1e6;
+
+ process.on('exit', function() {
+ bench.end(N / 1e6);
+ });
+
+ function cb1(arg1) {}
+ function cb2(arg1, arg2) {}
+ function cb3(arg1, arg2, arg3) {}
+
+ bench.start();
+ for (let i = 0; i < N; i++) {
+ if (i % 3 === 0)
+ setImmediate(cb3, 512, true, null);
+ else if (i % 2 === 0)
+ setImmediate(cb2, false, 5.1);
+ else
+ setImmediate(cb1, 0);
+ }
+}