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
function buildArrayPush(data) {
const len = data.length;
const result = [];
for (let i = 0; i < len; ++i) {
result.push(data[i]);
}
return result;
}
function buildArraySet(data) {
const len = data.length;
const result = Array(len);
for (let i = 0; i < len; ++i) {
result[i] = (data[i]);
}
return result;
}
function buildListAppend(data) {
const len = data.length;
const head = {
value: data[0],
previous: undefined,
next: undefined
};
const result = {
head: head,
tail: head,
size: 1
};
let tail = result.tail;
for (let i = 1; i < len; ++i) {
const node = {
value: data[i],
previous: tail,
next: undefined
};
result.tail = tail = tail.next = node;
result.size++;
}
return result;
}
const N = 1000;
const data = Array(N);
let array;
let list;
for (let i = 0; i < N; ++i) {
data[i] = ~~(Math.random() * 100);
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Array push |
| ready |
Array set |
| ready |
List append |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.