Skip to content

[std]: Use XXHash32 instead FNV-1a #1580

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

Merged
merged 16 commits into from
Feb 7, 2021
Merged

[std]: Use XXHash32 instead FNV-1a #1580

merged 16 commits into from
Feb 7, 2021

Conversation

MaxGraey
Copy link
Member

@MaxGraey MaxGraey commented Dec 14, 2020

XXHash32 has better quality and speed (especially for 32-bit, 64-bit and >= 16 bytes keys).

FNV-1a:

  • Poor uniform distribution. Only up to 14 bits can be used for the hash table (up to 2 ^ 14 hash table slots) without degradation
  • Bad avalanche effect
  • Speed: 4.5 cyclers per byte

XXHash:

  • Excellent uniform distribution
  • Near-perfect avalanche effect
  • Speed: ~1.7 cyclers per byte

string perf tests

u64 hash tests

old u64 hash (fnv-1a): 281.68000001460314 ms
new u64 hash (xxhash): 189.05499996617436 ms
  • I've read the contributing guidelines

@MaxGraey MaxGraey mentioned this pull request Dec 14, 2020
1 task
@dcodeIO dcodeIO merged commit 6905299 into AssemblyScript:master Feb 7, 2021
@MaxGraey MaxGraey deleted the xxhash branch February 7, 2021 03:00
@dcodeIO
Copy link
Member

dcodeIO commented Feb 7, 2021

🎉

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.

2 participants