fastutil icon indicating copy to clipboard operation
fastutil copied to clipboard

BigArrays.equals could use a more optimized loop using java.util.Arrays.equals

Open techsy730 opened this issue 4 years ago • 1 comments

EDIT: Nevermind, I see you addressed this. From the Javadoc: This method uses a backward loop. It is significantly faster than the corresponding method in {@link java.util.Arrays} While we would need to benchmark whether this is still true in OpenJDK 9 and up (where they introduced the vectorized loops), I can see it still being true in the OpenJDK 8 that we are targeting.

BigArrays.equals should use java.util.Arrays.equals for all sub arrays. This would allow us to take advantage of the hotspot intrinsics OpenJDK has for those (including vectorization in later JVM releases).

Except for the KEYS_USE_REFERENCE_EQUALITY case, in which case we will still need a handwritten loop to force the == comparison.

techsy730 avatar Jan 26 '21 16:01 techsy730

Well, let's keep this in mind for the Java 9-only release.

vigna avatar Jan 27 '21 08:01 vigna