slice55 (v2)

Revision 2 of this benchmark created on


Preparation HTML

<script>
  var Array__slice = [].slice;
  
  function slice1() {
   arguments.__proto__ = Array.prototype;
   return Array__slice.call(arguments);
  }
  
  function slice2() {
   var args = [];
   var i = arguments.length;
   while (i--) args[i] = arguments[i];
   return args;
  }
  
  function copy(a) {
   var args = [];
   var i = a.length;
   while (i--) args[i] = a[i];
   return args;
  }
  
  function slice3() {
   return copy(arguments);
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
slice1
slice1(1, 2, 3, 4, 5);
ready
slice2
slice2(1, 2, 3, 4, 5);
ready
slice3
slice3(1, 2, 3, 4, 5);
ready

Revisions

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