Split vs slice/indexOf

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

Revisions

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