Map set vs contructor

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Map set
const map = new Map();

new Array(10000).fill(null).map((_, index) => {
	map.set(index, index);
})
ready
Map constructor
new Map(new Array(10000).fill(null).map((_, index) => ([index, index]))).size
ready

Revisions

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