Map vs Set

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Map
for (let i = 0; i < 100; ++i) {
	const map = new Map()
	for (let i = 0; i < 1000; ++i)
		map.set(i, i)
	for (let i = 0; i < 1000; ++i)
		console.log(map.has(i))
}
ready
Set
for (let i = 0; i < 100; ++i) {
	const set = new Set()
	for (let i = 0; i < 1000; ++i)
		set.add(i)
	for (let i = 0; i < 1000; ++i)
		console.log(set.has(i))
}
ready

Revisions

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