Array.isArray vs instanceof Array vs _.isArray (v8)

Revision 8 of this benchmark created on


Preparation HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script>

Setup

var a = [1, 2, 3];
    var s = 'example';
    var f = false;

Test runner

Ready to run.

Testing in
TestOps/sec
Array.isArray
(Array.isArray(a) && (Array.isArray(s) || Array.isArray(f)));
ready
instanceof
(a instanceof Array && (s instanceof Array || f instanceof Array));
ready
_.isArray
_.isArray(a) && (_.isArray(s) || _.isArray(f))
ready

Revisions

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