From b63218206d4a15030efc941ebcbe9b0dcba7e5d8 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Sat, 8 Oct 2022 18:22:50 -0700 Subject: Add some more bench snippets --- bench/snippets/index-of.mjs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 bench/snippets/index-of.mjs (limited to 'bench/snippets/index-of.mjs') 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(); -- cgit v1.2.3