Split vs slice/indexOf (v2)

Revision 2 of this benchmark created on


Preparation HTML

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

Test runner

Ready to run.

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

Revisions

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