Closed fadedbee closed 1 year ago
I've never measured this directly, but I don't think it will make much of a difference. Like you suggested, the overwhelming majority of computational work is the same either way. Hardcoding the length would remove a few branches on the way down the call tree, which shouldn't matter much. The memcpy
of 32 bytes into the block buffer might also save a few instructions if the size is known, but I also expect that to be in the noise.
Thanks.
I am hashing large numbers of [u8; 32] and [u8;4096] arrays.
Would any significant speed-up be gained by optimising for fixed-size arrays, or is the computational weight of blake3 large enough that it wouldn't make even a 5% difference (vs hashing slices)?
(The hashes of [u8; 32] are blake3 being applied twice.)