regexp vs indexOf (v126)

Revision 126 of this benchmark created on


Preparation HTML

<script>
  var str = "hello world!";
  var regex = new RegExp('world');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Regexp
regex.test(str);
ready
indexOf
str.indexOf("world") !== -1;
ready

Revisions

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