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

Would it make sense to have comparative benchmarks against other digests? #37

Open
yxhuvud opened this issue Mar 16, 2023 · 3 comments
Open

Comments

@yxhuvud
Copy link

yxhuvud commented Mar 16, 2023

Would it make sense to have benchmarks for one or a few of the ruby built in digests as well, so that there is some ballpark comparison number?

@postmodern
Copy link
Owner

Interesting idea. I guess it could show that Digest::CRC* isn't any slower than Digest::MD5, etc, which are implemented by libssl. Although, I would wager the CRC algorithms will be faster than other cryptographic digests, since CRC has less arithmetic operations. I also do not want to potentially encourage people to use CRC digests instead of cryptographic hashes (which should guarantee no collisions), just because CRC is simply faster.

@yxhuvud
Copy link
Author

yxhuvud commented Mar 18, 2023

Right. Though as md5 is not secure anymore, that should be fine. I tried to just add Digest::MD5 to the benchmark script, but the results surprised me as md5 seems faster. I wonder if someone spent way too much time optimizing that one..

@dearblue
Copy link
Contributor

dearblue commented Jul 1, 2023

The simple lookup table algorithm used in digest-crc is not very fast for modern general-purpose processors.
Faster ones are in practical use.

For information:


My crc-turbo uses the "Slicing by 16" variant, but the zlib crc32() built into FreeBSD is about 1.6 times faster.
Also, lzma_crc64() by liblzma is about 3.6 times faster than my crc-turbo.

🤔 I may write an acceleration patch for digest-crc.
However, I cannot handle CLMUL extension instructions, so it will be equivalent to "Slicing by 16" or "Slicing by 8".

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

No branches or pull requests

3 participants