jQuery children vs find

JavaScript performance comparison

Revision 107 of this test case created by

Preparation code

	<form id="formElem" name="formElem" action="" method="post">
                    <fieldset class="step">
                        <img src="1.jpg" >
                    </fieldset>
                    <fieldset class="step">
                        <img src="2.jpg" >
                    </fieldset>
                    <fieldset class="step">
                        <img src="3.jpg" >
                    </fieldset>
                    <fieldset class="step">
                        <img src="3.jpg" >
                    </fieldset>
                   <fieldset class="step">
                        <img src="3.jpg" >
			<form id="formElem1" name="formElem1" action="" method="post">
			    <fieldset class="step">
				<img src="1.jpg" >
			    </fieldset>
			    <fieldset class="step">
				<img src="2.jpg" >
			    </fieldset>
			    <fieldset class="step">
				<img src="3.jpg" >
			    </fieldset>
			    <fieldset class="step">
				<img src="3.jpg" >
			    </fieldset>
			   <fieldset class="step">
				<img src="3.jpg" >
			    </fieldset>
			</form>
                    </fieldset>
		    <fieldset class="step">
                        <img src="3.jpg" >
			<form id="formElem1" name="formElem1" action="" method="post">
			    <fieldset class="step">
				<img src="1.jpg" >
			    </fieldset>
			    <fieldset class="step">
				<img src="2.jpg" >
			    </fieldset>
			    <fieldset class="step">
				<img src="3.jpg" >
			    </fieldset>
			    <fieldset class="step">
				<img src="3.jpg" >
			    </fieldset>
			   <fieldset class="step">
				<img src="3.jpg" >
			    </fieldset>
			</form>
                    </fieldset>
		    <fieldset class="step">
                        <img src="3.jpg" >
			<form id="formElem1" name="formElem1" action="" method="post">
			    <fieldset class="step">
				<img src="1.jpg" >
			    </fieldset>
			    <fieldset class="step">
				<img src="2.jpg" >
			    </fieldset>
			    <fieldset class="step">
				<img src="3.jpg" >
			    </fieldset>
			    <fieldset class="step">
				<img src="3.jpg" >
			    </fieldset>
			   <fieldset class="step">
				<img src="3.jpg" >
			    </fieldset>
			</form>
                    </fieldset>
		     <fieldset class="step">
                        <img src="3.jpg" >
			<form id="formElem1" name="formElem1" action="" method="post">
			    <fieldset class="step">
				<img src="1.jpg" >
			    </fieldset>
			    <fieldset class="step">
				<img src="2.jpg" >
			    </fieldset>
			    <fieldset class="step">
				<img src="3.jpg" >
			    </fieldset>
			    <fieldset class="step">
				<img src="3.jpg" >
			    </fieldset>
			   <fieldset class="step">
				<img src="3.jpg" >
			    </fieldset>
			</form>
                    </fieldset>
		     <fieldset class="step">
                        <img src="3.jpg" >
			<form id="formElem1" name="formElem1" action="" method="post">
			    <fieldset class="step">
				<img src="1.jpg" >
			    </fieldset>
			    <fieldset class="step">
				<img src="2.jpg" >
			    </fieldset>
			    <fieldset class="step">
				<img src="3.jpg" >
			    </fieldset>
			    <fieldset class="step">
				<img src="3.jpg" >
			    </fieldset>
			   <fieldset class="step">
				<img src="3.jpg" >
			    </fieldset>
			</form>
                    </fieldset>
		     <fieldset class="step">
                        <img src="3.jpg" >
			<form id="formElem1" name="formElem1" action="" method="post">
			    <fieldset class="step">
				<img src="1.jpg" >
			    </fieldset>
			    <fieldset class="step">
				<img src="2.jpg" >
			    </fieldset>
			    <fieldset class="step">
				<img src="3.jpg" >
			    </fieldset>
			    <fieldset class="step">
				<img src="3.jpg" >
			    </fieldset>
			   <fieldset class="step">
				<img src="3.jpg" >
			    </fieldset>
			</form>
                    </fieldset>
		    <fieldset class="step" id="ammy">
                        <img src="3.jpg" >
			<form id="formElem1" name="formElem1" action="" method="post">
			    <fieldset class="step">
				<img src="1.jpg" >
			    </fieldset>
			    <fieldset class="step">
				<img src="2.jpg" >
			    </fieldset>
			    <fieldset class="step">
				<img src="3.jpg" >
			    </fieldset>
			    <fieldset class="step">
				<img src="3.jpg" >
			    </fieldset>
			   <fieldset class="step">
				<img src="3.jpg" >
			    </fieldset>
			</form>
                    </fieldset>
                </form>

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

Preparation code output

<form id="formElem" name="formElem" action="" method="post"> <fieldset class="step"> <img src="1.jpg" > </fieldset> <fieldset class="step"> <img src="2.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > <form id="formElem1" name="formElem1" action="" method="post"> <fieldset class="step"> <img src="1.jpg" > </fieldset> <fieldset class="step"> <img src="2.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > </fieldset> </form> </fieldset> <fieldset class="step"> <img src="3.jpg" > <form id="formElem1" name="formElem1" action="" method="post"> <fieldset class="step"> <img src="1.jpg" > </fieldset> <fieldset class="step"> <img src="2.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > </fieldset> </form> </fieldset> <fieldset class="step"> <img src="3.jpg" > <form id="formElem1" name="formElem1" action="" method="post"> <fieldset class="step"> <img src="1.jpg" > </fieldset> <fieldset class="step"> <img src="2.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > </fieldset> </form> </fieldset> <fieldset class="step"> <img src="3.jpg" > <form id="formElem1" name="formElem1" action="" method="post"> <fieldset class="step"> <img src="1.jpg" > </fieldset> <fieldset class="step"> <img src="2.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > </fieldset> </form> </fieldset> <fieldset class="step"> <img src="3.jpg" > <form id="formElem1" name="formElem1" action="" method="post"> <fieldset class="step"> <img src="1.jpg" > </fieldset> <fieldset class="step"> <img src="2.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > </fieldset> </form> </fieldset> <fieldset class="step"> <img src="3.jpg" > <form id="formElem1" name="formElem1" action="" method="post"> <fieldset class="step"> <img src="1.jpg" > </fieldset> <fieldset class="step"> <img src="2.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > </fieldset> </form> </fieldset> <fieldset class="step" id="ammy"> <img src="3.jpg" > <form id="formElem1" name="formElem1" action="" method="post"> <fieldset class="step"> <img src="1.jpg" > </fieldset> <fieldset class="step"> <img src="2.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > </fieldset> <fieldset class="step"> <img src="3.jpg" > </fieldset> </form> </fieldset> </form>

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
children
$('#formElem').children('#ammy');
pending…
find
$('#formElem').find('#ammy')
pending…
find last of type
$('#formElem fieldset:last-of-type')
pending…
find last of type 2
$('#formElem > fieldset:last-of-type')
pending…
find last of type 3
// async test
$('#formElem').find('fieldset:last-of-type')
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.

0 Comments