instanceof vs. constructor (v2)

Revision 2 of this benchmark created on


Description

Which is faster for checking whether an object is a simple array?

Preparation HTML

<script>
  function fn(){};
  var a = new fn;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Use constructor
a.constructor == fn;
ready
Use instanceof
a instanceof fn
ready

Revisions

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