splice vs 2x substr

Benchmark created on


Preparation HTML

<script>
  var a = "pewpew:123456790",
      b = "pewpew123456790",
      r = [];
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
split
r = a.split(':');
ready
2x substr
r[0] = b.substr(0, 6);
r[1] = b.substr(6, 10);
ready

Revisions

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