Hello. I've been using this library through js-xxhash and i was wondering why does XXH('abcd', 0).toString(16) not equals XXH('abcd', 0).toNumber().toString(16)? Is there some standard it complies to? Other than that toNumber is much more performant and serves the same purpose.
var hash1 = XXH('abcd', 0);
var i, t1, t2, t3, t4;
t1 = performance.now();
for (i = 0; i < 100000; i++) {
hash1.toString(16)
}
t2 = performance.now();
t3 = performance.now();
for (i = 0; i < 100000; i++) {
Math.abs(hash1.toNumber()).toString(16);
}
t4 = performance.now();
console.log(t2 - t1);
console.log(t4 - t3);
Hello. I've been using this library through js-xxhash and i was wondering why does
XXH('abcd', 0).toString(16)
not equalsXXH('abcd', 0).toNumber().toString(16)
? Is there some standard it complies to? Other than thattoNumber
is much more performant and serves the same purpose.results of this code in Chrome 49
It's even worse in Edge