js object vs maps

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
obj
const obj = {}
for(let i=0; i<1000; i++){
	obj[i+""] = i
}
for(let i=0; i<1000; i++){
	let no = obj[i+""]
	obj[i+""] = no +1
}
for(let i=0; i<1000; i++){
	delete obj[i+""]
}
ready
map
const map = new Map()
for(let i=0; i<1000; i++){
	map.set(i+"", i)
}
for(let i=0; i<1000; i++){
	let no = map.get(i+"") 
	map.set(i, no+1)
}
for(let i=0; i<1000; i++){
	map.delete(i+"")
}
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.