Parameter destructuring vs direct property access

Benchmark created on


Setup

const size = 1000000
const list = new Array(size)
for (let i = 0; i < size; i++) {
	list[i] = { value: `value-${i}`, index: i }
}

Test runner

Ready to run.

Testing in
TestOps/sec
Iteration with parameter destructuring
list.forEach(({ value }) => value)
ready
Iteration with direct property access
list.forEach((item) => item.value)
ready

Revisions

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