diff options
Diffstat (limited to 'bench/snippets/index-of.mjs')
-rw-r--r-- | bench/snippets/index-of.mjs | 12 |
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(); |