arrayifying_arguments (v3)

Revision 3 of this benchmark created by arnout on


Test runner

Ready to run.

Testing in
TestOps/sec
slice
function arrayify_slice() {
  var args = Array.prototype.slice.call(arguments);
  var sum = 0;
  for(var i = 0; i < 100000; i++) {
    sum += i;
  }
}

arrayify_slice(1, 2, 3, 4);
ready
manual
function arrayify_manual() {
  var len = arguments.length;
  var args = new Array(len);
  for(var i = 0; i < len; i++) {
    args[i] = arguments[i];
  }
  var sum = 0;
  for(var i = 0; i < 100000; i++) {
    sum += i;
  }
}

arrayify_manual(1, 2, 3, 4);
 
ready
push
function arrayify_push() {
  var len = arguments.length;
  var args = [];
  for(var i = 0; i < len; i++) {
    args.push(arguments[i]);
  }
  var sum = 0;
  for(var i = 0; i < 100000; i++) {
    sum += i;
  }
}

arrayify_push(1, 2, 3, 4);
ready

Revisions

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

  • Revision 1: published by Malte Ubl on
  • Revision 2: published by Irakli Gozilishvili on
  • Revision 3: published by arnout on
  • Revision 4: published by Malte Ubl on
  • Revision 5: published by Irakli Gozilishvili on
  • Revision 6: published on
  • Revision 7: published on
  • Revision 8: published by mekwall on