Fast Array Length Checks (v3)

Revision 3 of this benchmark created on


Setup

const array = [1, 2, 3];
const length = array.length;

function strictEquality () {
	if (length === 0) return;
	// Should just pass through
}

function nonStrictEquality () {
	if (length == 0) return;
	// Should just pass through
}

function lessThanOrEqualTo () {
	if (length <= 0) return;
	// Should just pass through
}

function booleanReturn(){
	if(!length) return;
	}

Test runner

Ready to run.

Testing in
TestOps/sec
Strict equality ===
strictEquality();
ready
Non-strict Equality ==
nonStrictEquality();
ready
Less than or equal to <=
lessThanOrEqualTo();
ready
booleanReturn
booleanReturn();
ready

Revisions

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