isArray approaches

JavaScript performance comparison

Test case created by Louis Acresti

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  Array.prototype.array_ = true;
  
  var test = [],
      obj = {},
      str = 'blah blah',
      func = function(){};

};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
toString method
Object.prototype.toString.call( test ) === '[object Array]';
Object.prototype.toString.call( obj ) === '[object Array]';
Object.prototype.toString.call( str ) === '[object Array]';
Object.prototype.toString.call( func ) === '[object Array]';
pending…
prototype flag method
test.array_ === true;
obj.array_ === true;
str.array_ === true;
func.array_ === true;
pending…

Compare results of other browsers

Revisions

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

0 Comments