instanceof vs isPrototypeOf

JavaScript performance comparison

Test case created by

Preparation code

Benchmark.prototype.setup = function() {
  function Fee() {
    // . . .
  function Fi() {
    // . . .
  Fi.prototype = new Fee();
  function Fo() {
    // . . .
  Fo.prototype = new Fi();
  function Fum() {
    // . . .
  Fum.prototype = new Fo();
  var fum = new Fum();


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
fum instanceof Fee

Compare results of other browsers


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


Johannes Winger commented :

Why is Chrome 23 so much slower than 18, even version 14?

Also, quite an epic difference between IE9 and Opera 11!

Andrea Giammarchi commented :

Johannes jsperf simply compares tests as average. If a test is performed by a very fast machine and another is performed on a very old one ... you don't have real results.

You cannot compare i7 CPU with Atom, you know what I mean? Even if the browser is the same.

Opera 11 could have been mobile, and it's faster indeed than IE10 mobile