aboutsummaryrefslogtreecommitdiff
path: root/bench/snippets/set-timeout.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'bench/snippets/set-timeout.mjs')
-rw-r--r--bench/snippets/set-timeout.mjs16
1 files changed, 16 insertions, 0 deletions
diff --git a/bench/snippets/set-timeout.mjs b/bench/snippets/set-timeout.mjs
new file mode 100644
index 000000000..be7ea9bc4
--- /dev/null
+++ b/bench/snippets/set-timeout.mjs
@@ -0,0 +1,16 @@
+import { bench, run } from "../node_modules/mitata/src/cli.mjs";
+
+bench("setTimeout(, 4) 100 times", async () => {
+ var i = 100;
+ while (--i >= 0) {
+ await new Promise((resolve, reject) => {
+ setTimeout(() => {
+ resolve();
+ }, 4);
+ });
+ }
+});
+
+setTimeout(() => {
+ run({}).then(() => {});
+}, 1);