Equality Comparisons (v14)

Revision 14 of this benchmark created on


Setup

const objsMega = [];
const coercionMega = [];

for(let i=0; i<1000; i++) {
	objsMega.push({
		['_' + i]: i
	});
	coercionMega.push({
		['_' + i]: i,
		valueOf: () => "" + i
	});
}

Test runner

Ready to run.

Testing in
TestOps/sec
coercion ==
let sum = false;
for (i = 0; i< coercionMega.length; i++) {
	sum = coercionMega[i] == null || sum;
}
ready
coercion ===
let sum = false;
for (i = 0; i< coercionMega.length; i++) {
	sum = (coercionMega[i] === null || coercionMega[i] === undefined) || sum;
}
ready
objsMega ==
let sum = false;
for (i = 0; i< objsMega.length; i++) {
	sum = objsMega[i] == null || sum;
}
ready
objsMega ===
let sum = false;
for (i = 0; i< objsMega.length; i++) {
	sum = (objsMega[i] === null || objsMega[i] === undefined) || sum;
}
ready

Revisions

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