jQuery find versus context versions 1.4.2 to 1.5
JavaScript performance comparison
Preparation code
<script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.min.js"></script>
<script type="text/javascript">
var $15 = jQuery.noConflict();
</script>
<script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
var $144 = jQuery.noConflict();
</script>
<script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
var $142 = jQuery.noConflict();
</script>
<div class="wrapper">
<div class="innerWrapper">
<div class="button">
<a href="javascript:void(0)" id="button" class="buttonRef">
<span class="buttonText">Text</span>
</a>
</div>
</div>
</div>
<script>
var context5 = $15("div.wrapper");
var context44 = $144("div.wrapper");
var context42 = $142("div.wrapper");
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Get - document |
|
pending… |
Get - ID 1.4.2 |
|
pending… |
Get - ID 1.4.4 |
|
pending… |
Get - ID 1.5 |
|
pending… |
Context - ID 1.4.2 |
|
pending… |
Context - ID 1.4.4 |
|
pending… |
Context - ID 1.5 |
|
pending… |
Find - ID 1.4.2 |
|
pending… |
Find - ID 1.4.4 |
|
pending… |
Find - ID 1.5 |
|
pending… |
Get - Class 1.4.2 |
|
pending… |
Get - Class 1.4.4 |
|
pending… |
Get - Class 1.5 |
|
pending… |
Context - Class 1.4.2 |
|
pending… |
Context - Class 1.4.4 |
|
pending… |
Context - Class 1.5 |
|
pending… |
Find - Class 1.4.2 |
|
pending… |
Find - Class 1.4.4 |
|
pending… |
Find - Class 1.5 |
|
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:
- Revision 1: published by jcfant
- Revision 3: published by jcfant
- Revision 4: published
- Revision 5: published by nbast
- Revision 6: published by Addy Osmani
- Revision 7: published by JC Fant
- Revision 8: published by JC Fant and last updated
- Revision 9: published by JC Fant
0 comments