instanceof vs typeof (v4)

Revision 4 of this benchmark created by Sergey Kononenko on


Preparation HTML

<script>
  var a = [];
  var f = function() {};
  var x;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
array - instanceof
x = a instanceof Array;
ready
array - constructor
x = a.constructor === Array
ready
function - instanceof
x = f instanceof Function;
ready
function - constructor
x = f.constructor === Function;
ready

Revisions

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