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

Use xxhash for byte hashing #301

Merged
merged 1 commit into from
Jun 8, 2024
Merged

Use xxhash for byte hashing #301

merged 1 commit into from
Jun 8, 2024

Conversation

phadej
Copy link
Contributor

@phadej phadej commented May 17, 2024

Resolves #246

@phadej
Copy link
Contributor Author

phadej commented May 17, 2024

First line is xxhash, second line is master

benchmarking hash/ByteString/strict/5
time                 9.479 ns   (9.433 ns .. 9.546 ns)
time                 18.14 ns   (18.00 ns .. 18.33 ns)

benchmarking hash/ByteString/strict/8
time                 9.590 ns   (9.570 ns .. 9.622 ns)
time                 19.46 ns   (19.36 ns .. 19.58 ns)

benchmarking hash/ByteString/strict/11
time                 9.538 ns   (9.522 ns .. 9.562 ns)
time                 21.19 ns   (21.08 ns .. 21.32 ns)

benchmarking hash/ByteString/strict/40
time                 14.65 ns   (14.62 ns .. 14.69 ns)
time                 50.36 ns   (50.12 ns .. 50.70 ns)

benchmarking hash/ByteString/strict/128
time                 18.68 ns   (18.62 ns .. 18.79 ns)
time                 132.0 ns   (131.9 ns .. 132.2 ns)

benchmarking hash/ByteString/strict/512
time                 40.95 ns   (40.62 ns .. 41.42 ns)
time                 490.4 ns   (490.1 ns .. 490.8 ns)

benchmarking hash/ByteString/strict/2^20
time                 32.28 μs   (32.25 μs .. 32.33 μs)
time                 935.1 μs   (931.4 μs .. 943.7 μs)

the numbers are in the same ballpark as in #246 (comment), absolutely even better. That's maybe my cpu, -march=native and criterion/tasty measurement differences. Anyway, xxhash seems to be clearly better than fnv1, so I'll finish this branch soon.

@phadej
Copy link
Contributor Author

phadej commented May 18, 2024

I'm happy with how this is turning out. Hashing small lazy text and bytestring (<10 bytes) hashing is now slower, but everything else is a lot faster. Hashing small (and large) strict bytestring and text is faster.

@phadej phadej marked this pull request as ready for review May 18, 2024 16:11
@phadej phadej force-pushed the xxhash branch 2 times, most recently from bc060b6 to 03f2c0f Compare May 19, 2024 02:52
@phadej phadej merged commit b402cfb into master Jun 8, 2024
31 checks passed
@phadej phadej deleted the xxhash branch June 8, 2024 14:07
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.

xxHash instead of FNV?!
1 participant