regexp vs indexOf (v88)

Revision 88 of this benchmark created by steefow on


Description

Compare test of full string match, indexOf, equal

Preparation HTML

<script>
  var str = "hello world!";
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Regexp
str.match(/hello world!/);
ready
indexOf
str.indexOf("hello world!");
ready
equals
str === "hello world!";
ready
equals (safer)
str.toLowerCase() === "hello world!";
ready
equals (even safer)
str && str.toLowerCase() === "hello world!"
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.