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 wm = new WeakMap;
function getWM(item) {
return wm.get(item) || setWM(item);
}
function setWM(item) {
var value = Math.random() * item.id;
wm.set(item, value);
return value;
}
var arr = [];
function getArr(item, index) {
return arr[index] || setArr(item, index);
}
function setArr(item, index) {
var value = Math.random() * item.id;
arr[index] = value;
return value;
}
function spliceArr(length) {
arr.splice(length);
}
function createItems(length) {
var items = [];
for (var i = 0; i < length; i++) {
items[i] = {id: 1 + parseInt(Math.random() * length)};
}
return items;
}
var result = [];
var thousand = [];
var hundred = [];
Ready to run.
Test | Ops/sec | |
---|---|---|
Array |
| ready |
WeakMap |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.