Skip to content

Disable num-bigint-dig/u64_digit feature on wasm targets #252

Description

@jameysharp

WebAssembly doesn't have 128-bit integers, so on wasm targets LLVM implements 128-bit multiplies with a libcall to __multi3. That's slower than just doing arithmetic on smaller units.

I patched the rsa crate to remove the u64_digit feature from the num-bigint-dig dependency, and tested the patched version with the blind-rsa-signatures crate. The toy demo app I tested ran 15% faster under Wasmtime with this patch.

It would be nice if either this crate or num-bigint-dig would automatically determine what limb size to use based on the build target. Barring that, perhaps this crate should expose its own u64_digit feature that forwards to num-bigint-dig.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions