Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Cloning.
(version: 0)
Comparing performance of:
obj vs set vs map vs array
Created:
3 years ago
by:
Registered User
Jump to the latest result
Script Preparation code:
const size = 10000; var obj = {}; var set = new Set(); var map = new Map(); var arr = []; for (let i=0; i < size; i++) { const item = `item${i}`; obj[item] = true; set.add(item); map.set(item, true); arr.push(item); }
Tests:
obj
let copy = {...obj} delete copy.item5000
set
let copy = new Set(set) copy.delete("item5000")
map
let copy = new Map(map) copy.set("item5000", undefined);
array
let copy = [...arr] copy[5000] = undefined;
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
obj
set
map
array
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:
Lodash cloneDeep vs JSON Clone vs Bitfish Simple Clone
aasdfasdfasa
test for Vovan
Cloning an array
Comments
Confirm delete:
Do you really want to delete benchmark?