-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Add BufferedMurmur3Hasher to reduce allocations when hashing Strings #133226
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
Conversation
|
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
| */ | ||
| public class BufferedMurmur3Hasher extends Murmur3Hasher { | ||
|
|
||
| public static final int DEFAULT_BUFFER_SIZE = 32 * 4; // 32 characters, each character may take up to 4 bytes in UTF-8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe 128 * 4 to play it safe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is the default size, I'd like to be a bit more conservative with memory usage. This should probably also be enough for the OTLP endpoint as this is used primarily for attribute names. The attribute values are already in utf8-encoded byte arrays and directly use the update method.
server/src/test/java/org/elasticsearch/common/hash/BufferedMurmur3HasherTests.java
Outdated
Show resolved
Hide resolved
|
I've made another change to reduce the number of flushes. This should yield more throughput in the hasher as the amount of data it can hash at once is larger. |
Part of #132566