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
Just came across this article http://www.artzstudio.com/2009/04/jquery-performance-rules/ that recommends both tag qualifying class selectors as well as descending from an id for maximum jquery performance. Thought I'd test it out on his examples, because I've learned that you never want to tag qualify ids OR classes if you don't have to (similarly to CSS). However, considering the age of the article, the way jquery works could well be different now.
<div id="thisid" class="row list">
<div class="col-lg-12">
<div class="row">
<div class="col-lg-12">
<div class="inner">
<div class="further_in">
<a href="#">anchor</a>
<a href="#">
<img src="http://placehold.it/100x50" title="some image" />
</a>
</div>
</div>
<div class="inner">
<div class="further_in">
<a href="#">anchor</a>
<a href="#">
<img src="http://placehold.it/100x50" title="some image" />
</a>
</div>
</div>
<div class="inner">
<div class="further_in">
<a href="#">anchor</a>
<a href="#">
<img class="theimg" src="http://placehold.it/100x50" title="some image" />
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
Ready to run.
Test | Ops/sec | |
---|---|---|
descendant tag qualified class selector |
| ready |
decendant class selector |
| ready |
ID qualified decendant class selector |
| ready |
ID decendant tag qualified class selector |
| ready |
className only |
| ready |
tag qualified className |
| ready |
id only |
| ready |
tag qualified id |
| ready |
document.getElementById |
| ready |
add to var first. |
| ready |
add to var first 2 |
| ready |
| ready | |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.