new array vs splice vs slice (v74)

Revision 74 of this benchmark created on


Preparation HTML

<script>
  var a;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Slice
a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
a = a.slice(0,9);
ready
New
a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
a.splice(9,1)
ready
Splice
a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
a.splice(0, 10);
ready
Zero length
a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
a.length = 0;
ready

Revisions

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