From a3546e0c2fc6babbbc1df7160342ed78eb17dd9a Mon Sep 17 00:00:00 2001 From: Evan Date: Fri, 17 Feb 2023 12:40:45 -0800 Subject: [PATCH 1/2] Attempt to add wasm_bindgen_rayon --- Cargo.lock | 20 ++++++++++++++++++++ utilities/Cargo.toml | 17 ++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 6cfc844f02..c9d533dac6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2507,6 +2507,8 @@ dependencies = [ "serde_json", "snarkvm-utilities-derives", "thiserror", + "wasm-bindgen", + "wasm-bindgen-rayon", ] [[package]] @@ -2551,6 +2553,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "spmc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02a8428da277a8e3a15271d79943e80ccc2ef254e78813a166a08d65e4c3ece5" + [[package]] name = "sppark" version = "0.1.3" @@ -3010,6 +3018,18 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-rayon" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df87c67450805c305d3ae44a3ac537b0253d029153c25afc3ecd2edc36ccafb1" +dependencies = [ + "js-sys", + "rayon", + "spmc", + "wasm-bindgen", +] + [[package]] name = "wasm-bindgen-shared" version = "0.2.84" diff --git a/utilities/Cargo.toml b/utilities/Cargo.toml index 29b75a8cf7..c9e9118f8d 100644 --- a/utilities/Cargo.toml +++ b/utilities/Cargo.toml @@ -55,6 +55,14 @@ features = [ "getrandom", "std_rng" ] version = "1" optional = true +[dependencies.wasm-bindgen] +version = "0.2" +optional = true + +[dependencies.wasm-bindgen-rayon] +version = "1.0" +optional = true + [dependencies.serde] version = "1.0" default-features = false @@ -70,7 +78,14 @@ version = "0.3" default-features = false [features] -default = [ "std", "derive" ] +default = [ "std", "derive", "wasm" ] std = [ ] derive = [ "snarkvm-utilities-derives" ] +wasm = [ "rayon", "wasm-bindgen", "wasm-bindgen-rayon" ] parallel = [ "rayon", "num_cpus", "aleo-std/cpu" ] + +[target.wasm32-unknown-unknown] +rustflags = ["-C", "target-feature=+atomics,+bulk-memory,+mutable-globals"] + +[unstable] +build-std = ["panic_abort", "std"] From 6fb9165ff6f2e49dd127052c768f4ef683362c2d Mon Sep 17 00:00:00 2001 From: Evan Date: Sun, 19 Feb 2023 19:50:35 -0800 Subject: [PATCH 2/2] disable wasm-bindgen-rayon --- utilities/Cargo.toml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/utilities/Cargo.toml b/utilities/Cargo.toml index c9e9118f8d..d1aac57dfb 100644 --- a/utilities/Cargo.toml +++ b/utilities/Cargo.toml @@ -78,14 +78,8 @@ version = "0.3" default-features = false [features] -default = [ "std", "derive", "wasm" ] +default = [ "std", "derive" ] std = [ ] derive = [ "snarkvm-utilities-derives" ] -wasm = [ "rayon", "wasm-bindgen", "wasm-bindgen-rayon" ] +# wasm = [ "rayon", "wasm-bindgen", "wasm-bindgen-rayon" ] parallel = [ "rayon", "num_cpus", "aleo-std/cpu" ] - -[target.wasm32-unknown-unknown] -rustflags = ["-C", "target-feature=+atomics,+bulk-memory,+mutable-globals"] - -[unstable] -build-std = ["panic_abort", "std"]