jQuery children vs find

JavaScript performance comparison

Revision 49 of this test case created

Info

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

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id='goals'>
                <div id='goals_image' class='image_holder'><img src='images/goals.png'><img class='blue_image' src='images/goals_blue.png'></div>
                <div id='goals_text'>
                        <span class='header'>Our goals</span><br/>
                        When it comes to treading lighter on the earth, we always want to be better tomorrow than we are today. That's why we have measurable targets for people and nature.
                </div>
                <div class='more'>Learn more</div>
        </div>

Preparation code output

Our goals
When it comes to treading lighter on the earth, we always want to be better tomorrow than we are today. That's why we have measurable targets for people and nature.
Learn more

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
children()
var $this = $('#goals')

$this.children('.more')
$this.children('.image_holder').children('.blue_image')
$this
pending…
find()
var $this = $('#goals')

$this.find('.more')
$this.find('.blue_image')
$this
pending…
children() no variable
$('#goals').children('.more')
$('#goals').children('.image_holder').children('.blue_image')
$('#goals')
pending…
find() no variable
$('#goals').find('.more')
$('#goals').find('.blue_image')
$('#goals')
pending…
children() 1 sub
var $this = $('#goals')

$this.children('.more')
 
pending…
find() 1 sub
var $this = $('#goals')

$this.find('.more')
 
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