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
Testing collection needs on Map - how does it compare to regular array on find, filter and map?
var map = new Map();
var rec = {};
var arr = [];
for (var i=0; i< 20; i++) {
var num = Math.random() * 1000;
var idd = String(i)+num;
var obj = {id: idd, a: i !== 8000 ? false : true, coinFlip:num > 500}
arr.push({...obj})
map.set(idd, {...obj});
}
var findVal = arr[10].id;
var firstVal = arr[0].id;
Ready to run.
Test | Ops/sec | |
---|---|---|
Array map |
| ready |
Map map |
| ready |
Array filter |
| ready |
Map filter |
| ready |
Array find |
| ready |
Map find |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.