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
There seem to be very small effect in speed with SHA-256, regardless if asm is activated or not (with sha2:0.9.3 version)
The asm version is only about 10% faster than default / force-soft, and asm version is about 60% of speed Python/OpenSSL implementation.
There is small test case to demonstrate this at the end of issue. However, this also happens while calculating hashes of files, the Python version is about 2x as fast as Rust implementation.
The text was updated successfully, but these errors were encountered:
35VLG84
changed the title
sha2: 0.9.3: Very little effect of asm with SHA-256 / SHA-512?
sha2: 0.9.3: Very small effect of asm with SHA-256 / SHA-512?
Feb 3, 2021
Yes, it's a known property. Assembly from the project Nayuki is less efficient than implementations from OpenSSL, this is why I've created RustCrypto/asm-hashes#5. I think we can close this issue in its favor?
There seem to be very small effect in speed with SHA-256, regardless if
asm
is activated or not (with sha2:0.9.3 version)The
asm
version is only about 10% faster thandefault
/force-soft
, andasm
version is about 60% of speed Python/OpenSSL implementation.There is small test case to demonstrate this at the end of issue. However, this also happens while calculating hashes of files, the Python version is about 2x as fast as Rust implementation.
i5-8250U
rustc 1.49.0 (e1884a8e3 2020-12-29)
stable-x86_64-unknown-linux-gnu (default)
All runs below are done with:
cargo clean && cargo build --release && target/release/sha-rs
Default settings: (sha2 = "^0.9.3")
Rust: computing SHA-256 of 1073741824 bytes ('a')
hash: 6ac54ab637d27a69b34ce1ea5c8b98cda7c4b95ec9c0e16143fc5d4343b05113
time: 5.116825 s
Force-soft: (sha2 = { version = "^0.9.3", features = ["force-soft"]})
Rust: computing SHA-256 of 1073741824 bytes ('a')
hash: 6ac54ab637d27a69b34ce1ea5c8b98cda7c4b95ec9c0e16143fc5d4343b05113
time: 5.113324 s
ASM: (sha2 = { version = "^0.9.3", features = ["asm"]})
Rust: computing SHA-256 of 1073741824 bytes ('a')
hash: 6ac54ab637d27a69b34ce1ea5c8b98cda7c4b95ec9c0e16143fc5d4343b05113
time: 4.544902 s
Python (OpenSSL)
Py3: computing SHA-256 of 1073741824 bytes ('a')
hash: 6ac54ab637d27a69b34ce1ea5c8b98cda7c4b95ec9c0e16143fc5d4343b05113
time: 2.569319596 s
Rust example
Python example
The text was updated successfully, but these errors were encountered: