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
<div id="hello"></div>
<div class="bye"></div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
var allEls = document.getElementsByTagName("*"),
i,
idHash = { 'tag' : [], 'class' : [], 'id' : [] };
for( i in allEls ){
var thisEl = allEls[i],
classes = (thisEl.className) ? thisEl.className.split(' ') : [];
idHash.tag[thisEl.tagName] = idHash.tag[thisEl.tagName] || [];
idHash.tag[thisEl.tagName].push( thisEl );
for( j in classes ){
var classStr = classes[j];
idHash.class[classStr] = idHash.class[classStr] || [];
idHash.class[classStr].push( thisEl );
}
idHash.id[thisEl.id] = thisEl;
}
Ready to run.
Test | Ops/sec | |
---|---|---|
jQuery ID Selector |
| ready |
JavaScript ID Selector |
| ready |
jQuery Class Selector |
| ready |
JavaScript Class Selector |
| ready |
get element by id |
| ready |
get element by id to Jquery |
| ready |
ID Selection: Frontload ID assignments, cache, then read from cache |
| ready |
Class Selection: Frontload Class assignments, cache, then read from cache |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.