Split vs slice/indexOf (v3)

Revision 3 of this benchmark created by Matt McDonald on


Preparation HTML

<script>
  var str = "123-341235";
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Split
str.split('-')[1].slice(0);
ready
Slice/indexOf
str.slice(str.indexOf('-') + 1);
ready

Revisions

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