Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Map vs Object Improved
(version: 0)
Lookup of map vs object
Comparing performance of:
Map lookup vs Obj lookup
Created:
4 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var map = new Map(); var obj = {}; var string = "a"; for(let i = 0; i < 1000; i++) { map.set(string, 5); obj[string] = 5; string+="a" } var i = 0, count = 1000, a;
Tests:
Map lookup
var mapString = "a"; for (i = 0; i < count; i++) { a = map.has(mapString); mapString += "a" }
Obj lookup
var objString = "a"; for (i = 0; i < count; i++) { a = obj.hasOwnProperty(objString) objString += "a" }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Map lookup
Obj lookup
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 from() vs Map.keys() vs Map.values() vs spread (fixed)
array includes vs object key lookup, large arrays
Map vs Object read performance for a 1000 key lookup
Comments
Confirm delete:
Do you really want to delete benchmark?