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>
<script>
var throttle1 = (function () {
return function (fn, delay) {
delay || (delay = 100);
var last = +new Date;
return function () {
var now = +new Date;
if (now - last > delay) {
fn.apply(this, arguments);
last = now;
}
};
};
})();
var throttle2 = (function(){
return function(fn, delay) {
delay || (delay = 100);
var throttle = false;
function timeout(){ throttle = false; }
return function(){
if (throttle) { return; }
throttle = setTimeout(timeout, delay);
fn.apply(this, arguments);
};
};
})();
var throttle3 = (function(){
return function(fn, delay) {
delay || (delay = 100);
var throttle = false;
return function(){
if (throttle) { return; }
throttle = setTimeout(function(){ throttle = false; }, delay);
fn.apply(this, arguments);
};
};
})();
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
throttle1 |
| ready |
throttle2 |
| ready |
throttle3 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.