• Joel Sing's avatar
    crypto/sha1, crypto/sha256, crypto/sha512: use copy for partial block · 29fe067b
    Joel Sing authored
    Use copy rather than a hand rolled loop when moving a partial input
    block to the scratch area. This results in a reasonable performance
    gain when partial blocks are written.
    
    Benchmarks on Intel(R) Xeon(R) CPU X5650  @ 2.67GHz with Go amd64:
    
           benchmark               old MB/s     new MB/s  speedup
    SHA1   BenchmarkHash8Bytes        18.37        22.80    1.24x
    SHA256 BenchmarkHash8Bytes        11.86        13.78    1.16x
    SHA512 BenchmarkHash8Bytes         4.51         5.24    1.16x
    
           benchmark              old ns/op    new ns/op    delta
    SHA1   BenchmarkHash8Bytes          435          350  -19.54%
    SHA256 BenchmarkHash8Bytes          674          580  -13.95%
    SHA512 BenchmarkHash8Bytes         1772         1526  -13.88%
    
    R=agl, dave, bradfitz
    CC=golang-codereviews
    https://golang.org/cl/35840044
    29fe067b
Name
Last commit
Last update
..
archive Loading commit data...
bufio Loading commit data...
builtin Loading commit data...
bytes Loading commit data...
compress Loading commit data...
container Loading commit data...
crypto Loading commit data...
database/sql Loading commit data...
debug Loading commit data...
encoding Loading commit data...
errors Loading commit data...
expvar Loading commit data...
flag Loading commit data...
fmt Loading commit data...
go Loading commit data...
hash Loading commit data...
html Loading commit data...
image Loading commit data...
index/suffixarray Loading commit data...
io Loading commit data...
log Loading commit data...
math Loading commit data...
mime Loading commit data...
net Loading commit data...
os Loading commit data...
path Loading commit data...
reflect Loading commit data...
regexp Loading commit data...
runtime Loading commit data...
sort Loading commit data...
strconv Loading commit data...
strings Loading commit data...
sync Loading commit data...
syscall Loading commit data...
testing Loading commit data...
text Loading commit data...
time Loading commit data...
unicode Loading commit data...
unsafe Loading commit data...