Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Map vs Object 123456
(version: 0)
Lookup of map vs object
Comparing performance of:
Map lookup vs Obj lookup
Created:
7 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
const map = new Map(); const obj = {}; const count = 1000 const l = [] for (let x=0; x<=count; x++) { l.push([[''+x, x]]) } function bMap() { 'use strict' for (let j = 0; i+j < count; j++){ for (let i = 0; i < count; i++) { const [k, v] = l[i] if (!map.has(k)) { map.set(k, v) } else { map.set(k, map.get(k)+j) } } } } function bObj() { 'use strict' for (let j = 0; i+j < count; j++){ for (let i = 0; i < count; i++) { const [k, v] = l[i] if (!obj.hasOwnProperty(k)) { obj[k] = v } else { obj[k] = obj[k]+j } } } }
Tests:
Map lookup
bMap()
Obj lookup
bObj()
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:
Map vs Object 123
Map vs Object 1234
Map vs Object 12345
Map vs Object read performance for a 1000 key lookup
Comments
Confirm delete:
Do you really want to delete benchmark?