-
Notifications
You must be signed in to change notification settings - Fork 488
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
Fixes curve25519_dalek_bits
defaults for cross and wasm
#465
Fixes curve25519_dalek_bits
defaults for cross and wasm
#465
Conversation
cfg(target_family = "wasm")
and cfg(target_arch = "arm")
cfg(target_family = "wasm")
and cfg(target_arch = "arm")
f9f4cc2
to
826a532
Compare
Awesome! One thing: could we have documentation somewhere (can even be in the comments of build.rs) that explains what's going on and why? A link to something about WASM benchmarks would be nice to include too if you have it |
I'm fixing the build script for cross.. this is WIP for an hour or so. sorry |
Sidebar: we should probably add some cross tests, particularly for big-endian architectures. Here's an example of the ones we use for the @RustCrypto elliptic curve crates (although testing on both MSRV and stable is probably overkill): |
826a532
to
6383f2d
Compare
K. I'll add those here |
I'm not super familiar with WASM benchmarking but this seems like an option: https://docs.rs/easybench-wasm/latest/easybench_wasm/ @burdges you brought this up originally... any thoughts on how to do WASM benchmarks? |
6383f2d
to
97c84d7
Compare
Should we also build / test on windows and mac runners ? |
@pinkforest that's something I think is helpful when using |
97c84d7
to
c0d5ff6
Compare
Yeah that's a very good point |
c0d5ff6
to
7f8cfd8
Compare
This is now documented here alongside other backend selection changes: |
It would be good to confirm via a benchmark that WASM benefits from this, which is something I can poke at this weekend unless someone else wants to. |
With criterion could have to wrap the wasm blob with a runtime - e .g. with lunatic - system oriented - we do: But I think the easybench_wasm looks okay For browser few pop up: https://github.com/PSPDFKit-labs/pspdfkit-webassembly-benchmark Though those got a lot of host/guest (js/wasm) boundary stuff going that creates overhead but still diff runtimes. wasm is complicated beast to bench as there is tons of diff runtimes and not everyone agrees to "standards" 🤷♀️ |
I think sticking with browser benches (easybench looks okay) is probably enough for now. For this crate, I'd guess the most common place people will try to deploy their WASM is Chrome. |
FWIW - wasmer seems to benchmark sha1 crate via their runtime test |
97bd7df
to
31564a9
Compare
curve25519_dalek_bits
defaults for cross and wasm
I've set this to only fix the build.rs for cross-compile and wasm targets for now as keen to get this merged. |
c32b031
to
2bba4de
Compare
build.rs was using cfg(target) but it has to evaluate this from env TARGET as build.rs cfg(target) in build context is the builder host and not the target. This change fixes curve25519_dalek_bits lottery to determine the correct automatic curve25119_dalek_bits with the help of platforms crate. As discussed in dalek-cryptography#456 this also prepares for well known defaults for wasm and arm serial backend via cfg(curve25519_dalek_bits = "64") If the wasm32 or armv7 are going to be u64 serial by default these will be followed up on later.
2bba4de
to
3d2d3d9
Compare
I donno, but I'll forward the question to people who do. |
As discussed in #456
this sets well known defaults for:andcfg(target_family = "wasm")
cfg(target_arch = "arm")
By setting the 64 bit serial arithmetric viacfg(curve25519_dalek_bits = "64")
EDIT: I've used platforms crate via env TARGET to determine the actual cross target and this now fixes build.rs only.