chain vs simple selector

Benchmark created by chain vs simple selector on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div class="help">
  <input type="text" class="a"/>
  <input type="text" class="b"/>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
chain
var target = $('.help');
target.find('.a').hide().end().find('.b').show();
ready
simple
var target = $('.help');
target.find('.a').hide();
target.find('.b').show();
ready
without variable
$('.help').find('.a').hide();
$('.help').find('.b').show();
ready
chain without chain
$('.help').find('.a').hide().end().find('.b').show();
ready

Revisions

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

  • Revision 1: published by chain vs simple selector on