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
A very simple test to see which method of selection is faster for the same element:
It is expected that the third will not be the fastest, but it is included for thoroughness. The unknown is between the first two options
(Added jQuery/native test cases to demonstrate that if you're using jQuery, using a native call inside jQuery is quicker than using the rest (besides all native)
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<div id="grandparent">
<strong>
Grandparent
</strong>
textnode
<div id="parent">
<strong>
Parent
</strong>
textnode
<section id="child">
<strong>
Child
</strong>
textnode
</section>
</div>
</div>
Ready to run.
Test | Ops/sec | |
---|---|---|
Find by ID |
| ready |
Find by element |
| ready |
Find by ID and element |
| ready |
Native get by ID |
| ready |
jQuery native ID selector |
| ready |
jQuery native element selector |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.