ArrayBuffer Compare (v2)

Revision 2 of this benchmark created on


Setup

const hashA = (new Uint8Array(
[64,19,154,244,62,20,14,231,193,73,181,174,184,221,168,172,157,211,93,81,233,20,235,76,131,70,90,66,132,35,187,43]
)).buffer;
const hashB = (new Uint8Array(
[188,139,87,131,119,30,155,102,43,253,47,73,222,13,133,2,109,194,176,18,45,137,70,158,108,51,226,148,4,67,5,239]
)).buffer;

function compare(a, b) {
	return a.every((v, k) => v === b[k]);
}

Test runner

Ready to run.

Testing in
TestOps/sec
Uint8Array
compare(new Uint8Array(hashA), new Uint8Array(hashA)) && compare(new Uint8Array(hashA), new Uint8Array(hashB));
ready
Uint16Array
compare(new Uint16Array(hashA), new Uint16Array(hashA)) && compare(new Uint16Array(hashA), new Uint16Array(hashB));
ready
Uint32Array
compare(new Uint32Array(hashA), new Uint32Array(hashA)) && compare(new Uint32Array(hashA), new Uint32Array(hashB));
ready
BigUint64Array
compare(new BigUint64Array(hashA), new BigUint64Array(hashA)) && compare(new BigUint64Array(hashA), new BigUint64Array(hashB));
ready

Revisions

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