You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit eca2f55
Browse filesBrowse the repository at this point in the historyBrowse files
util: hash through std::io::copy, without zeroing a buffer
The 16KB stack buffer is zeroed for every input hashed, which was 45% of
the hash_multiple_files benchmark under CodSpeed's simulation: more than
hashing the data itself.
std::io::copy reads through a stack buffer that it does not zero for
readers able to fill uninitialized memory, such as files and byte slices.
Feed the digest (and the time macro finder) through it as a Write, so that
nothing is zeroed and nothing stays allocated between calls.
Local medians (divan), main / per-thread buffer / 16KB stack buffer / this:
hash_multiple_files 35.6 / 20.2 / 20.5 / 19.6 us
hash_header_file 7.4 / 5.9 / 5.9 / 5.7 us
hash_large_data 867 / 829 / 875 / 836 us
time_macro_finder_no_macros 300 / 274 / 299 / 268 us
0 commit comments