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
<section>
<span></span>
<div>
<div>
<div>
<p id="foo" class="foo">
bar
</p>
</div>
</div>
</div>
</section>
<script type="text/javascript">
var fastQSA = (function() {
var reID = /^#[^\s]+$/,
reTagSimple = /^\w+$/,
reClassSimple = /^\.[\w-]+$/;
return function fastQSA(sel) {
var ctx = document;
if (reID.test(sel)) {
return ctx.getElementById(sel.substr(1));
} else if (reTagSimple.test(sel)) {
return ctx.getElementsByTagName(sel);
} else if (reClassSimple.test(sel)) {
return ctx.getElementsByClassName(sel.substr(1));
} else {
return ctx.querySelectorAll(sel);
}
};
})(); // var fastQSA = (function() {
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
querySelector |
| ready |
querySelectorAll |
| ready |
getElementById |
| ready |
getElementsByClassName |
| ready |
getElementsByTagName |
| ready |
fastQSA(id) |
| ready |
fastQSA(tag) |
| ready |
fastQSA(class) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.