regexp vs indexOf (v114)

Revision 114 of this benchmark created on


Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
Regexp then regroup.
list = str.match(/(\d+|[^\d]+)/g);
strOut = [list[0], list[1] + list[2]];
ready
Search and then string ops.
index = str.search(/\d/);
strOut = [value.substring(0, index), value.substring(index)];
ready

Revisions

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