Currently _hex2array uses String.replace(/(..)/) to build an array out of a hex string. Even though convenient this is way much slower than a normal for loop with String.substr(). In my tests, the current solution is more than 80% slower than the proposed one, see the jsperf test case here.
Currently
_hex2array
usesString.replace(/(..)/)
to build an array out of a hex string. Even though convenient this is way much slower than a normalfor
loop withString.substr()
. In my tests, the current solution is more than 80% slower than the proposed one, see the jsperf test case here.