Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
techsy730 opened this issue Jan 26, 2021 · 1 comment

Comments

@techsy730
Copy link
Contributor

techsy730 commented Jan 26, 2021

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.

@vigna
Copy link
Owner

vigna commented Jan 27, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants