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

Implement a Hasher based on murmur3 #921

Closed
jiacai2050 opened this issue May 24, 2023 · 0 comments · Fixed by #928 or #931
Closed

Implement a Hasher based on murmur3 #921

jiacai2050 opened this issue May 24, 2023 · 0 comments · Fixed by #928 or #931
Assignees
Labels
feature New feature or request

Comments

@jiacai2050
Copy link
Contributor

Describe This Problem

We now use DefaultHasher inside partition lock, maybe we can change to a different Hasher based on murmur3 to improve perf.

Proposal

https://github.com/CeresDB/ceresdb/blob/27267b55faf1bce3c263b49d2fb61bcd5ce55c00/common_types/src/hash.rs#L7

Additional Context

It's better to do a simple benchmark about those Hasher.

@jiacai2050 jiacai2050 added the feature New feature or request label May 24, 2023
jiacai2050 pushed a commit that referenced this issue May 24, 2023
## Related Issues
Closes #921 

## Detailed Changes
Replace the hash algorithm from `DefaultHasher` to `ahash` for better
performance in partition lock.

## Test Plan
Time cost to compute hash on a 10-char string:
- DefaultHash: 10: 33.6364 ns
- ahash: 10: 19.0412 ns
- murmur3: 10: 33.0394 ns
jiacai2050 pushed a commit that referenced this issue May 26, 2023
## Related Issues
Closes #921 

## Detailed Changes
Be careful not to use `ahash` for non-memory scenarios.
Note that when an upstream dependency also references the same library,
their `FEATURES` are merged.
Reference: 
[1]
https://github.com/tkaitchuck/aHash/blob/master/README.md?plain=1#L22
## Test Plan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
2 participants