Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Map vs Object 3123
(version: 0)
Lookup of map vs object
Comparing performance of:
Map lookup vs Obj lookup vs Map add vs Obj Add
Created:
4 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var map = new Map(); var obj = {}; map.set('a', 5); obj['a'] = 5; var i = 0, count = 100000, a;
Tests:
Map lookup
for (i = 0; i < count; i++) { a = map.get('a'); }
Obj lookup
for (i = 0; i < count; i++) { a = obj['a']; }
Map add
for (i = 0; i < count; i++) { map.set(i, i) }
Obj Add
for (i = 0; i < count; i++) { obj[i] = i }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
Map lookup
Obj lookup
Map add
Obj Add
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
Array from() vs Map.keys()
Array from() vs Map.keys() vs Map.values() vs spread
array includes vs object key lookup, large arrays
Map vs Object read performance for a 1000 key lookup
Object.fromEntries vs Map
Comments
Confirm delete:
Do you really want to delete benchmark?