aboutsummaryrefslogtreecommitdiff
path: root/bench/snippets/index-of.mjs
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-10-08 18:22:50 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-10-09 02:02:47 -0700
commitb63218206d4a15030efc941ebcbe9b0dcba7e5d8 (patch)
tree7995587472cc8b87e1770f99b9e822388346584c /bench/snippets/index-of.mjs
parent349ccf229b6a246f56d54124156729aad5a8eba4 (diff)
downloadbun-b63218206d4a15030efc941ebcbe9b0dcba7e5d8.tar.gz
bun-b63218206d4a15030efc941ebcbe9b0dcba7e5d8.tar.zst
bun-b63218206d4a15030efc941ebcbe9b0dcba7e5d8.zip
Add some more bench snippets
Diffstat (limited to 'bench/snippets/index-of.mjs')
-rw-r--r--bench/snippets/index-of.mjs12
1 files changed, 12 insertions, 0 deletions
diff --git a/bench/snippets/index-of.mjs b/bench/snippets/index-of.mjs
new file mode 100644
index 000000000..a7aad7a1e
--- /dev/null
+++ b/bench/snippets/index-of.mjs
@@ -0,0 +1,12 @@
+import { bench, run } from "mitata";
+
+const input =
+ "Hello, World! foo bar baz qux quux corge grault garply waldo fred plugh xyzzy thud z a b c d e f g h i j k l m n o p q r s t u v w x y z".split(
+ " "
+ );
+
+bench(`Array.indexOf`, () => {
+ return input.indexOf("thud");
+});
+
+await run();