Daninet / hash-wasm

Lightning fast hash functions using hand-tuned WebAssembly binaries
https://npmjs.com/package/hash-wasm
Other
857 stars 50 forks source link

blake3 SIMD version #42

Open vans163 opened 1 year ago

vans163 commented 1 year ago

So there is this sightglass version but it deviates a lot due to clang being used here, many errors.

https://github.com/bytecodealliance/sightglass/blob/main/benchmarks/blake3-simd/Dockerfile

Daninet commented 1 year ago

I don't understand. What is the issue?

vans163 commented 1 year ago

The issue is a feature request to get SIMD version of blake3 ported+compiled, it seems the bindings emcc creates are not compatible with the JSON loading way hash-wasm does, im not even sure how to produce a .wasm compatible with the loader using emcc.

Testing the sightglass benchmarks I am also not sure what to make of them, but if I interpreted it right, the SIMD version is only 10% faster.

Daninet commented 1 year ago

I also measured it with some other hashing algorithms and I got similar results: SIMD only provided about 10% improvement in performance, which is not worth the effort + extra bundle size in my opinion. SIMD builds would require duplicated WASM binaries for each crypto algorithm to keep supporting browsers without SIMD.

vans163 commented 1 year ago

I also measured it with some other hashing algorithms and I got similar results: SIMD only provided about 10% improvement in performance, which is not worth the effort + extra bundle size in my opinion. SIMD builds would require duplicated WASM binaries for each crypto algorithm to keep supporting browsers without SIMD.

I was hoping 50%+ speedup with the other optimizations too (except tailcalls). Also it seems only Safari is behind on SIMD support ATM out of generally used browsers.