map test

Benchmark created on


Setup

items=[]
for(i = 0; i < 3000; i++) {
	items.push({
		id: i,
		prop1: `prop1 ${i}`,
		prop2: `prop2 ${i}`,
		prop3: `prop3 ${i}`,
		nested: {
		prop1: `prop1 ${i}`,
		prop2: `prop2 ${i}`,
		prop3: `prop3 ${i}`
		}
	})
}

Test runner

Ready to run.

Testing in
TestOps/sec
map
processed = items.map(i => ({...i, foo: 'bar', nested: {...i.nested, bar: 'foo'}}));


console.log(processed.length);
ready
no map
processed = items;
console.log(processed.length);
ready

Revisions

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