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 arr1 = new Array(5).map((it) => Math.round(Math.random()*10));
var arr2 = new Array(50).map((it) => Math.round(Math.random()*10));
var arr3 = new Array(5).map((it) => Math.round(Math.random()*10));
var arr4 = new Array(50).map((it) => Math.round(Math.random()*10));
function intersect(arr1, arr2) {
return arr1.some((value) => arr2.includes(value));
}
function intersectSet(arr1, arr2) {
return arr2.some((value) => arr1.has(value));
}
function test1() {
return intersect(arr1, arr2) || intersect(arr3, arr4);
}
var consArr = Array.from(new Set(arr1.concat(arr3)));
var consSet =new Set(arr1.concat(arr3));
function test2() {
return intersect(consArr, arr2.concat(arr4));
}
function test3() {
return intersectSet(consSet, arr2.concat(arr4));
}
const consArr24 = arr2.concat(arr4);
function test4() {
return intersectSet(consSet, consArr24);
}
</script>Ready to run.
| Test | Ops/sec | |
|---|---|---|
| test1 | | ready |
| test2 | | ready |
| test3 | | ready |
| test4 | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.