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
A = new Array(1000).fill(undefined).map(() => {
return Math.floor(1000 * Math.random());
});
B = null;
function containsAnyLoop(i,kal) {
for(var j=0;j<i.length;j++) {
for(var el in kal) {
if(i[j]===kal[el]) {
return true;
}
}
}
return false;
}
function containsAnyLoop2(i,kal) {
for(var j=0;j<i.length;j++) {
for(var k=0;k<kal.length;k++) {
if(i[j]===kal[k]) {
return true;
}
}
}
return false;
}
function containsAnyLoopInverse(i,kal) {
for(var el in kal) {
let ELEM = kal[el];
for(var j=0;j<i.length;j++) {
if(i[j]=== ELEM) {
return true;
}
}
}
return false;
}
function containsAnyFunctional(i,kal) {
return kal.some((elem) => i.includes(elem));
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Sanity |
| ready |
Functional |
| ready |
Loop |
| ready |
Loop Inverse |
| ready |
Loop2 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.