jQuery Multiple Selector Performance Problems
JavaScript performance comparison
Preparation code
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="http://code.jquery.com/jquery-git.js"></script>
<script>
var jqgit = jQuery.noConflict();
</script>
<div class="test" id="test">
<script>
var html = "";
for ( var i = 0; i < 100; i++ ) {
html += '<div class="find"></div>';
}
for ( var j = 0; j < 20; j++ ) {
html += '<div id="bigdiv' + j + '">';
html += '</div>';
}
document.write( html );
</script>
<input name='testinput' type='hidden' />
<select name='testselect'><option>1</option><option>2</option></select>
</div>
Preparation code output
<div class="test" id="test">
<input name='testinput' type='hidden' />
<select name='testselect'><option>1</option><option>2</option></select>
</div>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
Test | Ops/sec | |
---|---|---|
Two Selectors
|
|
pending… |
One Selector
|
|
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.
- Revision 1: published Justin Seger
- Revision 2: published
- Revision 3: published John Papa
- Revision 4: published
- Revision 5: published
- Revision 6: published
- Revision 7: published
- Revision 9: published
- Revision 11: published
0 Comments