Map arrays

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Map array with copy
const arr = [{
	a: 1
}, {
	a: 2
}, {
	a: 3
}, {
	a: 4
}, {
	a: 5
}]
const nextArr = arr.map((item) => {
	return {
		...item,
		b: item.a * 10
	}
})
ready
Map array without copy
const arr = [{
	a: 1
}, {
	a: 2
}, {
	a: 3
}, {
	a: 4
}, {
	a: 5
}]
const nextArr = arr.map((item) => {
	item.b = item.a * 10
	return item
})
ready

Revisions

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