moo tool values

Benchmark created on


Setup

function getObjectValues(object){
		var values = [];
		for (var key in object){
			if (hasOwnProperty.call(object, key)) values.push(object[key]);
		}
		return values;
	}
const myObject = {}
for (let i = 0; i < 1000; ++i) {
  myObject['hey' + i] = 'myWorld' + i;	
}

Test runner

Ready to run.

Testing in
TestOps/sec
moo-tool
let count = 0;
const values = getObjectValues(myObject);
if (values.length) {
	count += value.length;
}

ready
native
let count = 0;
const values = Object.values(myObject);
if (values.length) {
	count += value.length;
}
ready

Revisions

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