Array.prototype.slice vs [].slice (v2)

Revision 2 of this benchmark created on


Description

var slice = Array.prototype.slice; or var slice = [].slice;?

Setup

(Benchmark.prototype.setup = function() { }).toString = function() {
    return [
      '// 1 deep',
      '(function() {',
      '  // 2 deep',
      '  (function() {',
      '    // 3 deep',
      '    (function() {'
    ].join('\n');
  };
  
  (

Teardown

 }).toString = function() {
    return [
      '    }());',
      '    // end 3',
      '  }());',
      '  // end 2',
      '}());',
      '// end 1'
    ].join('\n');
  

Test runner

Ready to run.

Testing in
TestOps/sec
Array.prototype.slice
var slice = Array.prototype.slice;
ready
[].slice
var slice = [].slice;
ready

Revisions

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

  • Revision 1: published by Timmy Willison on
  • Revision 2: published on