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>
var pole = [];
for(var i = 0; i < 500; i++) {
pole.push([i, i]);
}
Array.prototype.each = function(callback, from, to) {
var length = this.length;
if(callback instanceof Function === false ||
length === 0) return this;
if(from === undefined)
from = 0;
if(to === undefined)
to = from < 0 && -from < length?0:length - 1;
if(from < 0)
from = -from >= length?0:length + from;
else if(from > length - 1)
from = length - 1;
if(to < 0)
to = -to >= length?(from > 0?0:length - 1):length + to;
else if(to > length - 1)
to = length - 1;
if(from > to) do {
if(callback.call(this, this[from], from) === false) return false;
} while(from-- !== to) else if(from < to) do {
if(callback.call(this, this[from], from) === false) return false;
} while(from++ !== to) else if(callback.call(this, this[from], from) === false)
return false; return this;
};
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
.reverse().forEach() |
| ready |
iteration |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.