GlMatrix equals() using designated, element-wise equals() (v4)

Revision 4 of this benchmark created on


Description

Use the library-provided equals() function, instead of performing inline floating-point comparison.

Preparation HTML

<!-- GLMatrix Update -->
<script src="https://rawcdn.githack.com/solarunes/gl-matrix/771dfba6e47e6ac001bc3e6152d4c1c86a268e52/dist/gl-matrix-min.js"></script>

<script>
window.glMatrixUpdate = glMatrix;
delete glMatrix;
</script>

<!-- GLMatrix v3.4.4 (release) -->
<script src="https://cdn.jsdelivr.net/npm/gl-matrix@3.4.4/gl-matrix-min.min.js"></script>

Setup

// random matrix
function randm(size) {
	return new Float32Array(size).map(el => el = Math.random() * 100);
}

Test runner

Ready to run.

Testing in
TestOps/sec
old vec2.equals()
for (let i = 0; i < 100; i++) {
	let a = randm(2);
	let a2 = randm(2);
	const eq = glMatrix.vec2.equals(a2, a);
}
ready
new vec2.equals()
for (let i = 0; i < 100; i++) {
	let a = randm(2)
	let a2 = randm(2);
	const eq = glMatrixUpdate.vec2.equals(a2, a);
}
ready

Revisions

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