jQuery Selector Benchmark

JavaScript performance comparison

Revision 13 of this test case created by

Preparation code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
		<div id="page1" data-type="page" class="pagecontent">
			<div class="titlebar"><h1>SOME SETTINGS</h1></div>
			<div class="content with_footbar scrollable_y">
				<form class="usetheme">
					<label>Choose a nickname<input type="text" /></label>
					<label>Choose a location<input type="text" /></label>
					<label>Choose a range<input type="range" min=0 max=2 /></label>
					<table class="scale">
						<tr><td>1 KM</td><td>2 KM</td><td>5 KM</td></tr>
					</table>
					<label>Select Gender</label>
					<table class="leftscale">
</div>
</div>
		<div id="page2" data-type="page" class="pagecontent">
			<div class="titlebar"><h1>SOME SETTINGS</h1></div>
			<div class="content with_footbar scrollable_y">
				<form class="usetheme">
					<label>Choose a nickname<input type="text" /></label>
					<label>Choose a location<input type="text" /></label>
					<label>Choose a range<input type="range" min=0 max=2 /></label>
					<table class="scale">
						<tr><td>1 KM</td><td>2 KM</td><td>5 KM</td></tr>
					</table>
					<label>Select Gender</label>
					<table class="leftscale">
</div>
</div>
		<div id="page3" data-type="page" class="pagecontent">
			<div class="titlebar"><h1>SOME SETTINGS</h1></div>
			<div class="content with_footbar scrollable_y">
				<form class="usetheme">
					<label>Choose a nickname<input type="text" /></label>
					<label>Choose a location<input type="text" /></label>
					<label>Choose a range<input type="range" min=0 max=2 /></label>
					<table class="scale">
						<tr><td>1 KM</td><td>2 KM</td><td>5 KM</td></tr>
					</table>
					<label>Select Gender</label>
					<table class="leftscale">
</div>
</div>

<script>
  Benchmark.prototype.setup = function() {
    //Save The Context
    var parentContext = document.getElementById('parent');
  };
</script>
    

Preparation code output

<div id="page1" data-type="page" class="pagecontent"> <div class="titlebar"><h1>SOME SETTINGS</h1></div> <div class="content with_footbar scrollable_y"> <form class="usetheme"> <label>Choose a nickname<input type="text" /></label> <label>Choose a location<input type="text" /></label> <label>Choose a range<input type="range" min=0 max=2 /></label> <table class="scale"> <tr><td>1 KM</td><td>2 KM</td><td>5 KM</td></tr> </table> <label>Select Gender</label> <table class="leftscale"> </div> </div> <div id="page2" data-type="page" class="pagecontent"> <div class="titlebar"><h1>SOME SETTINGS</h1></div> <div class="content with_footbar scrollable_y"> <form class="usetheme"> <label>Choose a nickname<input type="text" /></label> <label>Choose a location<input type="text" /></label> <label>Choose a range<input type="range" min=0 max=2 /></label> <table class="scale"> <tr><td>1 KM</td><td>2 KM</td><td>5 KM</td></tr> </table> <label>Select Gender</label> <table class="leftscale"> </div> </div> <div id="page3" data-type="page" class="pagecontent"> <div class="titlebar"><h1>SOME SETTINGS</h1></div> <div class="content with_footbar scrollable_y"> <form class="usetheme"> <label>Choose a nickname<input type="text" /></label> <label>Choose a location<input type="text" /></label> <label>Choose a range<input type="range" min=0 max=2 /></label> <table class="scale"> <tr><td>1 KM</td><td>2 KM</td><td>5 KM</td></tr> </table> <label>Select Gender</label> <table class="leftscale"> </div> </div> <script> Benchmark.prototype.setup = function() { //Save The Context var parentContext = document.getElementById('parent'); }; </script>

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
Context
$('.pagecontent','div');
pending…
Find
$('div.pagecontent');
pending…
Alternate Find
$('div').find('.pagecontent');
pending…
Children
$('div').children('.pagecontent');
pending…
Parent / Child Selector
$('div > .pagecontent');
pending…
Class Only
$('.pagecontent');
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

SOME SETTINGS

1 KM2 KM5 KM

SOME SETTINGS

1 KM2 KM5 KM

SOME SETTINGS

1 KM2 KM5 KM