Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Use wyhash for <til/hash.h> #13686

Merged
1 commit merged into from
Aug 10, 2022
Merged

Use wyhash for <til/hash.h> #13686

1 commit merged into from
Aug 10, 2022

Conversation

lhecker
Copy link
Member

@lhecker lhecker commented Aug 5, 2022

wyhash was chosen based on the results found in smhasher, were it proved
itself as an algorithm with little flaws and fairly high output quality.

While I have a personal preference for xxhash (XXH3 specifically), wyhash is a
better fit for this project as its source code is multiple magnitudes smaller,
simplifying the review and integration into the header-only hash.h file.

For use with hashmaps the hash quality doesn't actually matter much for
optimal performance and instead the binary size usually matters more.
But even in that scenario wyhash is fairly close to FNV1a (aka "FNV64").

The result is that this new hash algorithm will only have little impact on
hashmap performance if used over the standard FNV1a as used in the STL,
while simultaneously offering a vastly better hash quality.

This partially solves #13124.

Validation Steps Performed

  • Added test cases ✅

@lhecker lhecker requested a review from DHowett August 5, 2022 15:52
@lhecker lhecker force-pushed the dev/lhecker/wyhash branch from d9cb55d to a2763e4 Compare August 5, 2022 15:59
@lhecker lhecker force-pushed the dev/lhecker/wyhash branch from 42e5b8a to 0b0598d Compare August 5, 2022 16:33
@lhecker lhecker added the Area-Quality Stability, Performance, Etc. label Aug 5, 2022
Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

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

i-know-some-of-these-words.gif

@lhecker lhecker added the AutoMerge Marked for automatic merge by the bot when requirements are met label Aug 10, 2022
@ghost
Copy link

ghost commented Aug 10, 2022

Hello @lhecker!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit a43d502 into main Aug 10, 2022
@ghost ghost deleted the dev/lhecker/wyhash branch August 10, 2022 21:11
This pull request was closed.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Area-Quality Stability, Performance, Etc. AutoMerge Marked for automatic merge by the bot when requirements are met
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants