object direct access vs deconstruction

Benchmark created on


Setup

const obj = { str: 'hello world' };
const accessorDirect = obj => obj.str;
const accessorDeconsruct = ({ str }) => str;

Test runner

Ready to run.

Testing in
TestOps/sec
direct access
console.log(accessorDirect(obj));
ready
deconsruction
console.log(accessorDeconsruct(obj));
ready

Revisions

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