Closed mwoelke closed 2 months ago
It's still too early to enable SIMD for WebAssembly. It's not even part of WebAssembly yet; it's an extension whose specification can still change, and often requires to be explicitly enabled.
Just like many other WebAssembly extensions we could take advantage of. And unfortunately, WebAssembly doesn't support run-time feature detection.
Just to enable SIMD, it means that we would have to ship at least 2 versions of the entire libsodium webassembly code. Unfortunately, a lot of people would find that unacceptable.
Thank you for your quick response!
I was under the impression that run-time feature detection is supported because of this PR https://github.com/jedisct1/libsodium.js/issues/340 for argon2-browser. Turns out this is however using some external dependency.
Anyway, I will close this issue. Thanks again for your time :)
Hi there, neat library.
I was testing the performance of different Argon2 implementations for the web. Especially, I was testing the performance of libsodium.js against argon2-browser which utilizes the Argon2 reference implementation in WASM.
From my numbers, libsodium.js (pre-built browsers-sumo) is faster than argon2-browser when later is used without SIMD. With SIMD enabled, argon2-browser is about 35% faster.
The possibility of utilizing SIMD was already discussed in #133. According to caniuse SIMD is enabled in all major browsers since March 2023. I was therefore wondering about the current state of SIMD and libsodium.js.
Thanks in advance!
My numbers for reference (t=3):