Use faster hash for short arrays. (#39966)
* Use faster hash for AbstractArrays.
Since the current code already hashes all elements of small arrays (<4096 elements), this is basically a fast-path that avoids a lot of the math. It also xors the hashes, which should allow the compiler to vectorize hashing. As a result, I'm measuring about a 4x speedup for hashing a 20x20 matrix, and have not found cases where this is slower.
In addition, we can only hash the values for all arrays yielding to a 2x speedup.
Co-authored-by: Matt Bauman <mbauman@juliacomputing.com>
Co-authored-by: Jameson Nash <vtjnash@gmail.com>