jQuery children vs find (v35)

Revision 35 of this benchmark created on


Description

This testcase compares the performance from .children() and .find()

Preparation HTML

<form id="formElem" name="formElem" action="" method="post">
                    <fieldset class="step one">
                        <img src="1.jpg" class="image1">
                    </fieldset>
                    <fieldset class="step two">
                      <span class="span">
                        <img src="2.jpg" class="image2">
                      </span>
                    </fieldset>
                    <fieldset class="step three">
                        <img src="3.jpg" class="image3">
                    </fieldset>
                </form>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
one level - children
$('#formElem').children('.step');
ready
one level - find
$('#formElem').find('.step')
ready
one level - select child
$('#formElem .step')
ready
two levels - children
$('#formElem').children('.two').children('.span')
ready
two levels - find
$('#formElem').find('.span')
ready
three levels - children & find
$('#formElem').children('.two').find('.image2')
ready
three levels - find
$('#formElem').find('.image2')
ready

Revisions

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