Object.values 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 customValues() {
	return keys.map(function(key) {
		return obj[key];
	});
}

Test runner

Ready to run.

Testing in
TestOps/sec
Object.values
Object.values(obj);
ready
Custom Object.values
customValues();
ready

Revisions

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