I have a class representing bits and it uses ArrayBuffers
to store the
binary data. I'm trying to figure out if there is a faster method to perform a xor
between two ArrayBuffers
.
Note The length of the ArrayBuffers
are usually less than 10 bytes. But since the xor
operation is performed millions, if not billions of times, every millisecond saved matters.
// my current/simple method
// assume 'buf1', 'buf2' & 'result' are ArrayBuffers
for (var i=0; i<result.length; i++) {
result[i] = buf1[i] ^ buf2[i];
}
Note Seeking solution executable both locally and on browser.