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
Manual array lookups (array scans) vs. holey arrays vs. array lookups by index vs. object lookups.
Base test case: revision 29.
Changes:
A1 = [];
O1 = {};
var amount=50000;
for (var i=0; i < amount; i++) {
A1.push({id: i, name: 'name1'});
O1[''+i] = {id: i, name: 'name1'};
}
A2 = [];
A2[20000] = {id: 20000, name: 'name1'};
A2[30000] = {id: 30000, name: 'name1'};
A3 = [{id: 20000, name: 'name1'}, {id: 30000, name: 'name1'}];
Ready to run.
Test | Ops/sec | |
---|---|---|
Manual Array Lookup |
| ready |
Holey Array by Index |
| ready |
Object by Key String (dynamic) |
| ready |
Manual Array Lookup (small) |
| ready |
Object by Key Index |
| ready |
Array by Index |
| ready |
Object by Key String (static) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.