summaryrefslogtreecommitdiff
path: root/benchmark/process/queue-microtask-breadth.js
diff options
context:
space:
mode:
Diffstat (limited to 'benchmark/process/queue-microtask-breadth.js')
-rw-r--r--benchmark/process/queue-microtask-breadth.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/benchmark/process/queue-microtask-breadth.js b/benchmark/process/queue-microtask-breadth.js
new file mode 100644
index 0000000000..8bb33f6fde
--- /dev/null
+++ b/benchmark/process/queue-microtask-breadth.js
@@ -0,0 +1,21 @@
+'use strict';
+
+const common = require('../common.js');
+const bench = common.createBenchmark(main, {
+ n: [4e5]
+});
+
+function main({ n }) {
+ var j = 0;
+
+ function cb() {
+ j++;
+ if (j === n)
+ bench.end(n);
+ }
+
+ bench.start();
+ for (var i = 0; i < n; i++) {
+ queueMicrotask(cb);
+ }
+}