Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the trifecta div algorithm for 128-bit div on wasm #685

Merged
merged 1 commit into from
Sep 5, 2024

Commits on Sep 5, 2024

  1. Use the trifecta div algorithm for 128-bit div on wasm

    This commit updates the `#[cfg]` annotations used to select the
    implementation of 128-bit division in compiler-builtins on wasm targets.
    This is done with relation to
    https://github.com/WebAssembly/128-bit-arithmetic where performance of
    128-bit operations is being investigated on WebAssembly. While I don't
    know much about the particulars of the two algorithms involved here the
    comments indicate that the "trifecta" variant is preferred if possible
    but it's not selected on 32-bit architectures. This rationale isn't as
    applicable to WebAssembly targets because despite the 32-bit pointer
    width there are often wider-than-pointer operations available as it's
    typically run on 64-bit machines.
    
    Locally in testing a benchmark that performs division with a Rust-based
    bignum libraries whent from 350% slower-than-native to 220%
    slower-than-native with this change, a nice increase in speed. While
    this was tested with Wasmtime other runtimes are likely to see an
    improvement as well.
    alexcrichton committed Sep 5, 2024
    Configuration menu
    Copy the full SHA
    d840fb6 View commit details
    Browse the repository at this point in the history