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
It's a common pattern to use forEach, mp, filter, and others creating each time a closure runtime. This test aim is to compare different approaches to solve the same thing, bringing variables via closure or using the second argument
var // 10 items is enough
// since this test is not about the length
items = [0,1,2,3,4,5,6,7,8,9],
result
;
function pow(i) {
return i * i;
}
function copy(value, i, items) {
this[i] = items[i];
}
function redundantCopy(value, i, items) {
this.s[this.j++] = items[i];
}
Ready to run.
Test | Ops/sec | |
---|---|---|
common map |
| ready |
external map |
| ready |
common copy pattern |
| ready |
external copy pattern |
| ready |
common multiple references |
| ready |
external multiple references |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.