regexp vs indexOf case insensitive (v144)

Revision 144 of this benchmark created on


Description

Test which is faster - to lowercase the search string or to use regexp

Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
Regexp
str.match(/world/i);
ready
indexOf
str.toLowerCase().indexOf("world");
ready

Revisions

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