Object comparison vs string comparison.

Benchmark created on


Setup

const TYPE_THING = {name:"RECORD"};
const obj1 = TYPE_THING;
const obj2 = TYPE_THING;

const compareString = (comp1, comp2) => {
	return comp1.name === comp2.name
}
const compareObjRef = (comp1, comp2) => {
	return comp1 === comp2
}

Test runner

Ready to run.

Testing in
TestOps/sec
comparison to string
compareString(obj1,obj2)
ready
comparison to object ref
compareObjRef(obj1, obj2)
ready

Revisions

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