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

core: remove cached hash code for ItemId #1696

Merged
merged 2 commits into from
Sep 27, 2024

Conversation

brharrington
Copy link
Contributor

The id is generated from a hash function, typically SHA1 so we can just use a part of that for the hash code of the id object. Since data is sometimes partitioned and routed based on the most and least significant bits, we pick one of the middle bytes to reduce the liklihood of collisions.

Benchmarks show it is about 25% slower to access the hash code this way, but it does provide some memory savings and compute savings when creating an id instance since the murmur hash doesn't need to be computed.

The id is generated from a hash function, typically SHA1 so
we can just use a part of that for the hash code of the id
object. Since data is sometimes partitioned and routed based
on the most and least significant bits, we pick one of the
middle bytes to reduce the liklihood of collisions.

Benchmarks show it is about 25% slower to access the hash
code this way, but it does provide some memory savings and
compute savings when creating an id instance since the murmur
hash doesn't need to be computed.
@brharrington brharrington added this to the 1.8.0 milestone Sep 27, 2024
@brharrington brharrington merged commit 7474caa into Netflix:main Sep 27, 2024
5 checks passed
@brharrington brharrington deleted the id-hashcode branch September 27, 2024 13:28
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

Successfully merging this pull request may close these issues.

2 participants