wide-midnight-78598
06/28/2024, 4:02 AMhashlib.file_digest
and then in Rust, using the sha2
library, it took 2x as long. I swapped over to ring
as per https://rust-lang-nursery.github.io/rust-cookbook/cryptography/hashing.html and that ended up being roughly on par with hashlib, as I would have expected. Ran this over 230k files and took the total run time as my comparison pointwide-midnight-78598
06/28/2024, 4:09 AMwide-midnight-78598
06/28/2024, 4:19 AMrhythmic-morning-87313
06/28/2024, 7:28 AMaverage-vr-56795
06/28/2024, 8:17 AMwide-midnight-78598
06/28/2024, 12:05 PMsha2
lib, I enabled some of the feature flags that bought it roughly inline with ring
(like, close enough that I didn't care) - otherwise, the code I used for the hashing was pulled straight from https://rust-lang-nursery.github.io/rust-cookbook/cryptography/hashing.html#calculate-the-sha-256-digest-of-a-file - and I just played with the buffer sizewide-midnight-78598
06/28/2024, 12:08 PMaverage-vr-56795
06/28/2024, 12:09 PMRUSTFLAGS="-C target-cpu=native"
average-vr-56795
06/28/2024, 12:10 PMwide-midnight-78598
06/28/2024, 12:11 PMwide-midnight-78598
06/28/2024, 12:13 PMaverage-vr-56795
06/28/2024, 12:14 PM--release
+ native CPU + buffering IO are the only things that jump out to me 🙂wide-midnight-78598
06/28/2024, 12:16 PMpowerful-scooter-95162
07/01/2024, 4:19 PMwide-midnight-78598
07/01/2024, 4:33 PMwide-midnight-78598
07/01/2024, 4:35 PMpowerful-scooter-95162
07/01/2024, 5:50 PMpowerful-scooter-95162
07/01/2024, 5:50 PMwide-midnight-78598
07/01/2024, 9:03 PM