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
Testing the cost of scrolling on a benchmark.
<script>
var all = document.getElementsByTagName('*');
var scrollEl = (function() {
var scrollTop,
div = document.createElement('div'),
body = document.body,
bodyStyle = body.style,
bodyHeight = bodyStyle.height,
html = document.documentElement,
htmlStyle = html.style,
htmlHeight = htmlStyle.height,
result = body;
bodyStyle.height = htmlStyle.height = 'auto';
div.style.cssText = 'display:block;height:9001px;';
body.insertBefore(div, body.firstChild);
scrollTop = html.scrollTop;
if (html.clientWidth !== 0 && ++html.scrollTop && html.scrollTop == scrollTop + 1) {
result = html;
}
body.removeChild(div);
bodyStyle.height = bodyHeight;
htmlStyle.height = htmlHeight;
html.scrollTop = scrollTop;
return result;
}());
</script>
var all = window.all,
count = -1,
scrollEl = window.scrollEl,
scrollHeight = scrollEl.scrollHeight;
Ready to run.
Test | Ops/sec | |
---|---|---|
Without scrolling |
| ready |
Scrolling |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.