Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Set: Array vs Object vs Map vs WeakMap access (3)
(version: 0)
Comparing performance of:
Map.set vs WeakMap.set vs array vs Object vs object[symbol]
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var map = new Map(); var weakMap = new WeakMap() var array = []; var object = {}; var symbol = Symbol('next'); var id = 0;
Tests:
Map.set
map.set({},99);
WeakMap.set
weakMap.set({}}
array
array[id++] = 99
Object
object[“”+(id++)] = 99
object[symbol]
object[symbol] = id++
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (5)
Previous results
Fork
Test case name
Result
Map.set
WeakMap.set
array
Object
object[symbol]
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!
Comments
Confirm delete:
Do you really want to delete benchmark?