No Destructure for Single Prop vs Destructure

Benchmark created on


Setup

const myData = { foo: 'foo', bar: 'bar', baz: 'baz'};


const wrappedData = { myData }

Test runner

Ready to run.

Testing in
TestOps/sec
No destructure
const getData = () => {
	return wrappedData.myData.foo;
}

const foo = getData();


return foo;
ready
Destructure
const getData = () => {
	return wrappedData.myData;
	}

const { foo } = getData();


return foo;
ready

Revisions

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