Object.entries vs custom

Benchmark created on


Setup

const obj = {};
for (let i = 0; i < 20; i++) {
	obj[crypto.randomUUID()] = crypto.randomUUID();
}
Object.seal(obj);

const keys = Object.keys(obj);

function customEntriesMap(key) {
	return [key, obj[key]];
}

function customEntries() {
	return keys.map(customEntriesMap);
}

Test runner

Ready to run.

Testing in
TestOps/sec
Object.entries
Object.entries(obj);
ready
Custom Object.entries
customEntries();
ready

Revisions

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