regexp vs indexOf for end of string (v79)

Revision 79 of this benchmark created by Sebastian Janzen on


Preparation HTML

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

Test runner

Ready to run.

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

Revisions

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