-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
hashsum: improve hashsum using 32KiB bufreader #8869
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
base: main
Are you sure you want to change the base?
Conversation
please run hyperfine with the three commands |
use uucore::translate; | ||
|
||
const NAME: &str = "hashsum"; | ||
const READ_BUFFER_SIZE: usize = 32 * 1024; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add an comment explaining what is this magic number
(like GNU is fine)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
GNU testsuite comparison:
|
833e079
to
6220e13
Compare
6220e13
to
4817e3b
Compare
GNU testsuite comparison:
|
4817e3b
to
1876d0d
Compare
GNU testsuite comparison:
|
hyperfine results comparing main, PR and GNU
|
GNU testsuite comparison:
|
both codspeed and my system don't see any difference:
or
|
i guess it is windows specific ?! |
Hello,
In my WSL environment, I found that gnu md5sum was faster than coreutils md5sum. So I investigated via strace and found that GNU used 32KiB size buffers while coreutils used 8KiB as shown below to read files. This PR aims to do the same, there by closing the performance gap to an extent.
md5sum
Version details
With this PR I dont much improvement when compared to main branch for smaller inputs. Its only for larger inputs that we will notice anything.
Benchmarks when compared to main
Even with this PR, I still find that GNU hashsum is still 20% faster in my system for very large inputs.
Since I am doing this with WSL, it would be nice if others could also check this patch once on there linux systems.