Skip to content

add new experimental xxh3 hash algorithm#39

Merged
shepmaster merged 13 commits intoshepmaster:masterfrom
flier:xxh3
Jun 11, 2020
Merged

add new experimental xxh3 hash algorithm#39
shepmaster merged 13 commits intoshepmaster:masterfrom
flier:xxh3

Conversation

@flier
Copy link
Collaborator

@flier flier commented Aug 26, 2019

Add new experimental xxh3 hash algorithm which was optimized for small key and also support AVX2/SSE2 for large key.

  • hash with seed (64bits) or secret (&[u8])
  • hash to 64 or 128 bits output
  • support SIMD with AVX2/SSE2
  • sanity check from upstream
  • implements core::hash::Hasher
  • implements core::hash::BuildHasher
  • implements digest::Digest
  • implements serde::{Deserialize, Serialize}
  • benchmark with criterion

What am I missing?

Thanks

@shepmaster
Copy link
Owner

Thanks!

Heh, I've had the XXH3 tab open in my browser ever since I read about it on Hacker News, but I've been too busy to act on it. 😉

Can you tell me a little about the process you followed to port the code over? When I did the original version, I basically copied over the C code into a Rust file and iterated until the code compiled (then iterated until the tests passed!). Based on some of the names, it looks like you might have followed the same process.

I'm also interested in knowing what your usecase(s) are for XXH3, if you are able to share about them.

The code is quite dense, so it will probably take me a while to review it. Please feel free to ping me every week or so if I haven't otherwise shown any signs of life.

/cc @quark-zju, in case you are interested.

@quark-zju
Copy link
Contributor

Thanks for tagging me. We're interested. However, it is not quite ready for on-disk format (our main usecase) yet, according to README:

It can be used for ephemeral data, and for tests, but avoid storing long-term hash values yet.

We definitely want to switch once it gets stabilized 😃

@flier
Copy link
Collaborator Author

flier commented Aug 27, 2019

Sure, I use similar process to port the code, just rename some C style name or extract some Trait as Rust style. So, you can review the code base on C code side by side.

I'm working in a network security company, so we have a lot of scenes which need high performance (high throughput and low latency) hash algorithm, that's why I'm trying to evaluate and port T1HA and XXH3, I also maintain some experimental fasthash with C binding.

Thanks

@NotSqrt NotSqrt mentioned this pull request Dec 9, 2019
@NotSqrt
Copy link

NotSqrt commented Dec 9, 2019

I just compared twox_hash::Xxh3Hash64 from https://github.com/flier/twox-hash/tree/xxh3 to twox_hash::XxHash64 :
twox_hash::XxHash64 is 3 times faster on small keys (my use case is HashMap with small strings as keys : 7 to 10 chars).

@shepmaster shepmaster mentioned this pull request Apr 16, 2020
@That3Percent
Copy link

You asked what the use-cases are for using XXH3. My primary need for using this over XxHash64 would be that it has a 128-bit output.

Copy link
Owner

@shepmaster shepmaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's time to go ahead and merge this. I'll be honest and say that I haven't fully grokked the new algorithm (to the level I'd like), but my skimming seemed fine.

@shepmaster
Copy link
Owner

@flier @quark-zju please let me know if either of you would be interested in becoming a co-maintainer!

@shepmaster shepmaster merged commit a28b8a9 into shepmaster:master Jun 11, 2020
@flier
Copy link
Collaborator Author

flier commented Jun 13, 2020

@shepmaster Sure, I could handle issues about xxh3, thanks.

@mjhostet
Copy link

FWIW the "stable" xxh3 algorithm was just released, suitable for on-disk use etc. https://github.com/Cyan4973/xxHash/releases/tag/v0.8.0

It's worth verifying that this implementation matches the final version.

flier added a commit to flier/twox-hash that referenced this pull request Jul 31, 2020
@flier flier mentioned this pull request Jul 31, 2020
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants