WebAssembly / 128-bit-arithmetic

WebAssembly proposal for 128-bit arithmetic
https://webassembly.github.io/spec/
Other
5 stars 1 forks source link

Evaluate: Peformance in various WebAssembly engines #7

Open alexcrichton opened 1 month ago

alexcrichton commented 1 month ago

For the initial proposal an implementation was made in Wasmtime and Cranelift. The primary motivation of this proposal is performance which means that other engines must also be evaluated as well. Other engines should be evaluted both before/after this proposal to see if the same performance gap that was exposed by Wasmtime is additionally exposed in other engines as well. This will help motivate various instructions as "broadly applicable to all engines" vs "just this one engine needs to improve".

alexcrichton commented 1 month ago

I've collated some benchmarks at https://github.com/alexcrichton/wasm-benchmark-i128 and here's some results of WebAssembly as-is today with no modifications. All results here are reported as percent slowdown relative to native, so smaller is better.

The x86_64 computer here is Intel(R) Core(TM) i9-14900K and the aarch64 computer is a macOS M2 Pro.

engine blind-sig lehmer mul-bignum fib_10000 shl shr div-bignum
Node 22.6.0 x86_64 556% 250% 337% 138% 24% 66% 342%
Wasmtime 23.0.2 x86_64 638% 357% 388% 129% 8% 22% 388%
Node 22.6.0 aarch64 486% 105% 233% 82% -4% 1% 233%
Wasmtime 23.0.2 aarch64 328% 113% 196% 80% 9% 8% 222%
Firefox 129.0 aarch64 446% 110% 232% 83% 15% 18% 255%

I don't personally have other hardware to test on at this time. Testing in the spidermonkey shell or d8 will require some more work in terms of setup scripts and integration so I also haven't done that yet.

I'll also note that this is just an initial set of benchmarks, and the set of benchmarks should probably grow over time.