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
Selector speed of searching for data attribute versus class $('div.selectMe') vs $('div[data-select-me=true]')vs $('div[data-select-me2]') vs $('div#selectMe')
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<div>
<div id='selectMe' class='selectMe' data-select-me2 data-select-me='true'>
<p>
Some paragraph.
</p>
</div>
<div class='selectMe'>
<div data-select-me='true'>
</div>
</div>
<div id='selectMe'>
<div data-select-me='true'>
</div>
</div>
<div data-select-me='true'>
<div class='selectMe'>
</div>
</div>
<div data-select-me2>
<div class='selectMe'>
</div>
</div>
</div>
Ready to run.
Test | Ops/sec | |
---|---|---|
Select by Data Attr Value |
| ready |
Select by Class |
| ready |
Select by id |
| ready |
Select by Data Attr |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.