multiple selector vs combine selector

Benchmark created by Thomas Genin on


Description

What is the fatest ? A bunch of jquery hide one after the other one or a big selector which hide all of them in once

Preparation HTML

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<div id=0>
  0
</div>
<div id=2>
  2
</div>
<div id=3>
  3
</div>
<div id=4>
  4
</div>
<div id=5>
  5
</div>
<div id=6>
  6
</div>
<div id=7>
  7
</div>
<div id=8>
  8
</div>
<div id=9>
  9
</div>

Setup

$('div').show();

Teardown


    $('div').show();
  

Test runner

Ready to run.

Testing in
TestOps/sec
Multiple
$('#0').hide();
$('#1').hide();
$('#2').hide();
$('#3').hide();
$('#4').hide();
$('#5').hide();
$('#6').hide();
$('#7').hide();
$('#8').hide();
$('#9').hide();
ready
Combine
$('#0, #1, #2, #3, #4, #5, #6, #7, #8, #9').hide();
ready

Revisions

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

  • Revision 1: published by Thomas Genin on