regexp vs indexOf (v120)

Revision 120 of this benchmark created by Timothy on


Preparation HTML

<script>
  var str = "hello world!";
  var str2 = "hello WORLD!".toLocaleLowerCase();
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Regexp
str.search(/world/);
ready
indexOf
str.indexOf("world");
ready
Case Insensitive Regexp
str2.search(/WORld/i);
ready
toLowerCase indexOf
str2.indexOf("WORld".toLocaleLowerCase());
ready

Revisions

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