hide show

JavaScript performance comparison

Revision 2 of this test case created

Preparation code

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js">
</script>
<div id="testDiv">
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
  <div class="test">
    Who cares what's actually in this div?
  </div>
</div>
<script>
  Benchmark.prototype.setup = function() {
    function s0() {
      $("#testDiv").find(".test").show();
    }

    function h0() {
      $("#testDiv").find(".test").hide();
    }

    function s1() {
      $(".test").show();
    }

    function h1() {
      $(".test").hide();
    }

    function s2() {
      $("#testDiv").find("test").each(function(){
$(this).css({
        'display': 'block'
      });});
    }

    function h2() {
      $("#testDiv").find("test").each(function(){
$(this).css({
        'display': 'none'
      });});
    }
  }

  function s3() {
    $("#testDiv").find("test").each(function() {
      $(this).style.display = 'block';
    });
  }

  function h3() {
    $("#testDiv").find("test").each(function() {
      $(this).style.display = 'none';
    });
  }

  function s4() {
    $("#testDiv").find("test").css({
      'display': 'block'
    });
  }

  function h4() {
    $("#testDiv").find("test").css({
      'display': 'none'
    });
  }

  function s5() {
    $(".test").css({
      'display': 'block'
    });
  }

  function h5() {
    $(".test").css({
      'display': 'none'
    });
  }

  function s6() {
    $("#testDiv").find("test").each(function() {
      this.style.display = 'block';
    });
  }

  function h6() {
    $("#testDiv").find("test").each(function() {
      this.style.display = 'none';
    });
  }
</script>

Preparation code output

Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?
Who cares what's actually in this div?

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
1
s1();
h1();
pending…
3
s3();
h3();
pending…
4
s4();
h4();
pending…
5
s5();
h5();
pending…
s0
s0();
h0();
pending…
s2
s2();
h2();
pending…
6
s6();
h6();
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. Here’s a list of current revisions for this page:

0 comments

Add a comment