jQuery 1.5 Unique Traversal
JavaScript performance comparison
Info
Preparation code
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script>var a = jQuery.noConflict(), aa;</script>
<script src="http://code.jquery.com/jquery-1.5.js"></script>
<script>var b = jQuery.noConflict(), bb;</script>
<div id="tests" style="display:none;"></div>
<script>
Benchmark.prototype.setup = function() {
var i, j, ac = 0,
bc = 0,
html = "";
for (j = 0; j < 20; j++) {
html += "<div class='jq144'>";
for (i = 0; i < 5; i++) {
html += "<div>abcdefghijklmnopqrstuvwxyz</div><div>0123456789</div>";
}
html += "</div>";
}
for (j = 0; j < 20; j++) {
html += "<div class='jq150'>";
for (i = 0; i < 5; i++) {
html += "<div>abcdefghijklmnopqrstuvwxyz</div><div>0123456789</div>";
}
html += "</div>";
}
document.getElementById("tests").innerHTML = html;
aa = a(".jq144");
bb = b(".jq150");
};
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
.children() - jQuery 1.4.4 |
|
pending… |
.children() - jQuery 1.5 |
|
pending… |
.next() - jQuery 1.4.4 |
|
pending… |
.next() - jQuery 1.5 |
|
pending… |
.prev() - jQuery 1.4.4 |
|
pending… |
.prev() - jQuery 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 John Resig
- Revision 8: published
- Revision 9: published
- Revision 10: published
- Revision 11: published
- Revision 12: published
- Revision 13: published
- Revision 15: published
5 comments
very useful and interesting information !
Hey I got :
19,513 ops/sec for .prev() - jQuery 1.4.4
16,598 ops/sec for .prev() - jQuery 1.5
Testing in Firefox 3.6.13 on Windows 7
How come???
The same environment (Windows 7 Utimate, FireFox 3.6.13): .prev() on 1.4.4: 14,595 .prev() on 1.5 : 13,201
Seems that the "Compare results of other browsers" is not correct at all
Well it does depend on hardware I would imagine. And also what other apps are running, what plugins do you have installed, etc.. that's why they need a large sample base to estimate performance for "most" users.
Ronak Shah, White Rose, are you running on the Atom processor?