-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Currently this proposal's overview states that division on native platforms always goes to __udivti3
so it's probably not worth adding anything. Additionally the overview cites that while x64 has the ability to divide a 128-bit number by a 64-bit number that's not what 128-bit division in wasm wants in theory.
Despite these two claims benchmarking shows that bignum division is significantly slower in WebAssembly than it is in native. Later benchmarking has shown that with a prototype version of this proposal the gap can be significantly reduced, but it's still quite far behind native.
I've done some further investigation and found that the Rust compiler's implementation of __udivti3
wasn't optimal for wasm and native architectures were using a different algorithm. After updating the algorithm used and enabling a prototype for this proposal on x64 the performance gap is that wasm is now 36% behind native. This is significantly closer than previous attempts (yay!)
Given all this I'd like to open this issue to track further investigation of this. For example are there remaining low-hanging fruit in this 36% that can be easily picked by slightly changing this proposal or adding a new opcode? I'm not sure at this time!