Closed XLearner closed 1 year ago
It sounds like you're comparing Node's crypto
module, which IIUC is a wrapper for the optimized ASM implementations in OpenSSL, against a pure Rust implementation of SHA-2 compiled to WebAssembly.
This isn't really a fair comparison, because you're comparing hand-optimized architecture-specific assembly to WASM, which is interpreted/JITed.
Some fair comparisons would be:
Is it worth having benchmarks with and without -C codegen-units=1
? It'd avoid regressions from cross crate stuff like https://docs.rs/blake2/latest/blake2/type.Blake2b.html
Hi Maintainer, I wanted to use the sha2::Sha256 to do "Proof of Work" with rust and transformed Rust code to "WebAssembly" for the web page finally. So I did some tests separately in Node and rust. However, the result is unsatisfying. Node is much faster than Rust. I am curious about what reason could be leading to the disparity in the speed?
Here is my testing code: demo-node.txt demo-rs.txt