regexp vs indexOf for end of string (v84)

Revision 84 of this benchmark created on


Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
Regexp
/^hello/.test(str);
ready
indexOf
str.indexOf("hello");
ready
Prepared regexp
str.match(REGEXP);
ready
Inline regexp
str.match(/^hello/);
ready

Revisions

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