object destructure simple

Benchmark created on


Setup

const obj = [...Array(1000).keys()].reduce((acc, i) => {
	const key = String.fromCharCode('a'.charCodeAt(0) + ((i / (26 * 26)) % 26)) + String.fromCharCode('a'.charCodeAt(0) + ((i / 26) % 26)) + String.fromCharCode('a'.charCodeAt(0) + (i % 26));
	acc[key] = i;
	return acc;
}, {});

Test runner

Ready to run.

Testing in
TestOps/sec
manual
const aaa = obj["aaa"];
const aab = obj["aab"];
const aac = obj["aac"];
ready
fancy
const { aaa, aab, aac } = obj;
ready

Revisions

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