RustCrypto / hashes

Collection of cryptographic hash functions written in pure Rust
1.81k stars 245 forks source link

sm3: Improve fn gg2 performance #477

Closed KiyanYang closed 1 year ago

KiyanYang commented 1 year ago

Before:

test sm3_10    ... bench:          26 ns/iter (+/- 0) = 384 MB/s
test sm3_100   ... bench:         254 ns/iter (+/- 7) = 393 MB/s
test sm3_1000  ... bench:       2,471 ns/iter (+/- 41) = 404 MB/s
test sm3_10000 ... bench:      24,372 ns/iter (+/- 589) = 410 MB/s

After:

test sm3_10    ... bench:          25 ns/iter (+/- 0) = 400 MB/s
test sm3_100   ... bench:         246 ns/iter (+/- 8) = 406 MB/s
test sm3_1000  ... bench:       2,404 ns/iter (+/- 97) = 415 MB/s
test sm3_10000 ... bench:      23,811 ns/iter (+/- 424) = 419 MB/s
newpavlov commented 1 year ago

Thank you!