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 arrpush_small_val = [];
function arrpush_small() {
var arr1 = [];
for (a = 0; a < 100; a++)
{
arr1 = [];
for (i = 0; i < 5000; i++)
{
arr1.push('elem' + i);
}
}
return arr1;
}
var arrlen_small_val = [];
function arrlen_small() {
var arr2 = [];
for (b = 0; b < 100; b++)
{
arr2 = [];
for (j = 0; j < 5000; j++)
{
arr2[arr2.length] = 'elem' + j;
}
}
return arr2;
}
var arrpush_large_val = [];
function arrpush_large() {
var arr1 = [];
for (i = 0; i < 500000; i++)
{
arr1.push('elem' + i);
}
return arr1;
}
var arrlen_large_val = [];
function arrlen_large() {
var arr2 = [];
for (j = 0; j < 500000; j++)
{
arr2[arr2.length] = 'elem' + j;
}
return arr2;
}
console.log(
arrpush_small_val[Math.round(Math.random())] + arrlen_small_val[Math.round(Math.random())] + arrpush_large_val[Math.round(Math.random())] + arrlen_large_val[Math.round(Math.random())]
);
Ready to run.
Test | Ops/sec | |
---|---|---|
arrpush_small |
| ready |
arrlen_small |
| ready |
arrpush_large |
| ready |
arrlen_large |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.