Closed newpavlov closed 1 year ago
And now
On Loongson 3A5000 @ 2.3GHz:
Without this patch:
test sha1_10 ... bench: 33 ns/iter (+/- 0) = 303 MB/s
test sha1_100 ... bench: 308 ns/iter (+/- 0) = 324 MB/s
test sha1_1000 ... bench: 2,559 ns/iter (+/- 2) = 390 MB/s
test sha1_10000 ... bench: 25,057 ns/iter (+/- 11) = 399 MB/s
With asm-hashes patch:
test sha1_10 ... bench: 32 ns/iter (+/- 0) = 312 MB/s
test sha1_100 ... bench: 291 ns/iter (+/- 0) = 343 MB/s
test sha1_1000 ... bench: 2,450 ns/iter (+/- 1) = 408 MB/s
test sha1_10000 ... bench: 24,079 ns/iter (+/- 12) = 415 MB/s
With this patch: :+1:
test sha1_10 ... bench: 31 ns/iter (+/- 0) = 322 MB/s
test sha1_100 ... bench: 286 ns/iter (+/- 0) = 349 MB/s
test sha1_1000 ... bench: 2,408 ns/iter (+/- 1) = 415 MB/s
test sha1_10000 ... bench: 23,637 ns/iter (+/- 12) = 423 MB/s
@heiher
Your findings are fixed. Can you verify that this implementation passes the tests (do not forget to enable the loongarch64_asm
feature)? If it does, then I think we can merge and release it.
@newpavlov Thank you. The tests are PASSED.
$ cargo test -F loongarch64_asm
Compiling version_check v0.9.4
Compiling typenum v1.16.0
Compiling proc-macro-hack v0.5.20+deprecated
Compiling blobby v0.3.1
Compiling cfg-if v1.0.0
Compiling generic-array v0.14.7
Compiling hex-literal-impl v0.2.3
Compiling hex-literal v0.2.2
Compiling crypto-common v0.1.6
Compiling block-buffer v0.10.4
Compiling digest v0.10.7
Compiling sha1 v0.10.5 (/home/hev/rust/hashes/sha1)
Finished test [optimized + debuginfo] target(s) in 5.48s
Running unittests src/lib.rs (/home/hev/rust/hashes/target/debug/deps/sha1-efff1781e455b298)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running tests/mod.rs (/home/hev/rust/hashes/target/debug/deps/mod-bf2a6b498c858bf9)
running 2 tests
test sha1_main ... ok
test sha1_rand ... ok
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s
Doc-tests sha1
running 1 test
test sha1/src/lib.rs - (line 14) ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.34s
Based on code from https://github.com/RustCrypto/asm-hashes/pull/66
@heiher Can you check whether I translated assembly correctly? Both by running tests and by manual inspection of the code.
Also it would be nice if cross had support for LoongArch64, so we could run tests properly in our CI.