jQuery children vs find (v61)

Revision 61 of this benchmark created on


Description

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

Preparation HTML

<script src="https://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>

Test runner

Ready to run.

Testing in
TestOps/sec
children()
var $this = $('#goals')

$this.find('> *');
 
ready
find()
var $this = $('#goals')

$this.find('> *')
 
ready
children() no variable
$('#goals').children('> *')
 
ready
find() no variable
$('#goals').find('> *')
$('#goals').find('> *')
$('#goals')
ready
children() 1 sub
var $this = $('#goals')

$this.children('> *')
 
ready
find() 1 sub
var $this = $('#goals')

$this.find('> *')
 
ready

Revisions

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