jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
Checking how querySelectorAll('parent child') or '.parent .child' selection performs against combinations of getElementsByTagName, getElementsByClassName, jQuery
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<ul class="root-ul"><li><a class="link word" href="#word">word</a>
</li><li><a class="link glass" href="#glass">glass</a>
</li><li><a class="link lorum" href="#lorum">lorum</a>
</li><li><a class="link ipsum" href="#ipsum">ipsum</a>
</li><li><a class="link dolor" href="#dolor">dolor</a>
</li><li><a class="link sit-amet" href="#sit-amet">sit-amet</a>
</li></ul>
window.console && console.log && nodes.length != 6 && console.log('nodes:',nodes.length, nodes);
Ready to run.
Test | Ops/sec | |
---|---|---|
querySelectorAll |
| ready |
querySelectorAll + push.apply + length set |
| ready |
jQuery('.root-ul .link') |
| ready |
getElementsByClassName + getElementsByClassName |
| ready |
getElementsByClassName + getElementsByTagName |
| ready |
getElementsByClassName + iteration |
| ready |
getElementsByClassName + iteration + length set |
| ready |
jQuery with traversal |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.