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
Which is the fastest way to loop through a static nodeList from querySelectorAll
<h1>Loop through static node list - for Vs forEach</h1>
<nav aria-label="test navigation">
<ul id="here"></ul>
</nav>
const output = document.getElementById('here');
let lines = '';
for (let c = 0;c < 30000; c++) {
lines += '<li class="lazy"><a href="#">Lazy</a></li>';
}
output.innerHTML = lines;
Ready to run.
Test | Ops/sec | |
---|---|---|
Using normal for loop |
| ready |
Using for of |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.