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
Using js Map object - should we check if the key/val exists before delete?
const myMap = new Map();
function getRandomString(length) {
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
let result = '';
const charactersLength = characters.length;
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
for (let i = 0; i < 1000; i++) {
myMap.set(i, getRandomString(10));
}
myMap.set('foo', 'bar');
Ready to run.
Test | Ops/sec | |
---|---|---|
with check |
| ready |
run delete |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.