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
var a = [1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0];
var b1 = a.concat([1, 2]);
var b2 = a.concat([{a: 1, b: 'a'}, {c: 'dsfase', d: {a: 1, x: 2}}]);
if (c.length !== b1.length || c.length !== b2.length) {
throw {message: "Test failed! b.length !== c.length"};
}
for (var i = 0, l = c.length; i < l; i++) {
// we compare with || before l - 2 and with && afterwards
if (i < l - 2)
if (b1[i] !== c[i] || b2[i] !== c[i]) {
throw {message: "Test failed! Arrays' content not equal on index " + i};
}
else
if (b1[i] !== c[i] && b2[i] !== c[i]) {
throw {message: "Test failed! Arrays' content not equal on index " + i};
}
}
c[0].test = 'hi';
if (b1[0].test === 'hi' || b2[0].test === 'hi') {
throw {message: "Not a deep clone"};
}
Ready to run.
Test | Ops/sec | |
---|---|---|
slice, clean |
| ready |
slice, dirty |
| ready |
concat, clean |
| ready |
concat, dirty |
| ready |
while loop clean |
| ready |
while loop dirty |
| ready |
slice(0) clean |
| ready |
slice(0) dirty |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.