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

[Feature] Use JDK9 Arrays.compare to check bytes prefix for PrefixLookup #271

Open
2 tasks done
swuferhong opened this issue Dec 26, 2024 · 0 comments
Open
2 tasks done
Labels
component=kv feature New feature or request

Comments

@swuferhong
Copy link
Collaborator

Search before asking

  • I searched in the issues and found nothing similar.

Motivation

Currently, RocksDBKv#isPrefixEquals() very inefficient to compare arrays byte by byte. Java9 provides a more efficient way Arrays.compare(compare(byte[] a, int aFromIndex, int aToIndex, byte[] b, int bFromIndex, int bToIndex)), underlying it leverages SIMD instructions.

As it is only supported since Java9, we can implement it in a similar way like Crc32C. (the method can get the running JDK environment, if Java9 use the support Arrays.compare() method).

Note: Micro benchmarks is needed to compute the benefits of new Arrays.compare() on JDK9.

Solution

No response

Anything else?

No response

Willingness to contribute

  • I'm willing to submit a PR!
@swuferhong swuferhong added the feature New feature or request label Dec 26, 2024
@wuchong wuchong changed the title [Feature] Change the RocksDBKv#isPrefixEquals() to Arrays.compare(compare(byte[] a, int aFromIndex, int aToIndex, byte[] b, int bFromIndex, int bToIndex)) in JDK9 [Feature] Use JDK9 Arrays.compare to check bytes prefix for PrefixLookup Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component=kv feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants