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
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<!-- -->
<span>
Width:
</span>
<span id='Width'>
</span>
<br/>
<span>
Height:
</span>
<span id='Height'>
</span>
<!-- -->
<script>
var id_width = document.getElementById('Width'),
id_height = document.getElementById('Height'),
jquery_window = $(window);
//Custom function taken from...
//http://stackoverflow.com/questions/4976936/get-the-available-browser-window-size-clientheight-clientwidth-consistently-ac
//derived from...
//http://jibbering.com/faq/#getWindowSize
//
//original has been modified
//
var getWindowSize = (function() {
var docEl = document.documentElement,
d = document,
b = document.body,
IS_BODY_ACTING_ROOT = docEl && docEl.clientHeight === 0;
// Used to feature test Opera returning wrong values
// for documentElement.clientHeight.
function isDocumentElementHeightOff() {
var div = d.createElement('div'),
r;
div.style.height = "50000px";
d.body.insertBefore(div, d.body.firstChild);
r = d.documentElement.clientHeight > 49000;
d.body.removeChild(div);
return r;
}
if (typeof document.clientWidth === "number") {
return {
width: function() {
return d.clientWidth;
},
height: function() {
return d.clientHeight;
}
};
} else if (IS_BODY_ACTING_ROOT || isDocumentElementHeightOff()) {
return {
width: function() {
return b.clientWidth;
},
height: function() {
return b.clientHeight;
}
};
} else {
return {
width: function() {
return docEl.clientWidth;
},
height: function() {
return docEl.clientHeight;
}
};
}
})();
</script>
id_width.innerHTML = $window_width + '';
id_height.innerHTML = $window_height + '';
Ready to run.
Test | Ops/sec | |
---|---|---|
jQuery |
| ready |
Custom Vanilla |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.