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
We test different algorithms for copying an array of 1K numbers. Most tests make a "shallow copy" of the array. A "deep copy" of the array can be obtained using:
const size = 1_000;
const arrayNumbers1K = Array(size).fill(0);
for (let i = 0; i < size; ++i)
arrayNumbers1K[i] = Math.random() * 1000;Ready to run.
| Test | Ops/sec | |
|---|---|---|
| JSON.parse(JSON.stringify()) | | ready |
| structuredClone() | | ready |
| .push.apply() | | ready |
| ... Spread operator | | ready |
| Array.of() | | ready |
| Array.from() | | ready |
| Object.assign() | | ready |
| .concat() | | ready |
| .filter() | | ready |
| .flat() | | ready |
| .map() | | ready |
| .slice() | | ready |
| .forEach() + .push() | | ready |
| .forEach() + new Array(length) | | ready |
| for + .push() | | ready |
| for + new Array(length) | | ready |
| while + .push() | | ready |
| while + new Array(length) | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.