chore(performance): use fluence-blake3 with wasm32 SIMD support (#806)

* chore(preformance): use fluence-blake3

Enable wasm32 SIMD on the appropriate target.  It gives a noticeable performance improvement.

The smaller memory size on benchmarks is due to unrelated stack size reduction.
This commit is contained in:
Ivan Boldyrev 2024-02-04 18:27:49 +04:00 committed by GitHub
parent 47420723bc
commit 9d4094dc99
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 3531 additions and 3339 deletions

17
Cargo.lock generated
View File

@ -155,9 +155,9 @@ dependencies = [
name = "air-interpreter-cid" name = "air-interpreter-cid"
version = "0.9.0" version = "0.9.0"
dependencies = [ dependencies = [
"blake3",
"cid", "cid",
"digest 0.10.7", "digest 0.10.7",
"fluence-blake3",
"multihash 0.19.1", "multihash 0.19.1",
"multihash-codetable", "multihash-codetable",
"rkyv", "rkyv",
@ -950,7 +950,6 @@ dependencies = [
"cc", "cc",
"cfg-if 1.0.0", "cfg-if 1.0.0",
"constant_time_eq 0.3.0", "constant_time_eq 0.3.0",
"digest 0.10.7",
] ]
[[package]] [[package]]
@ -2429,6 +2428,20 @@ dependencies = [
"toml", "toml",
] ]
[[package]]
name = "fluence-blake3"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a3c704928408e9b8f7c9d5b24a4f205dd5cb89d378aa31a01140df810093bf5"
dependencies = [
"arrayref",
"arrayvec 0.7.4",
"cc",
"cfg-if 1.0.0",
"constant_time_eq 0.3.0",
"digest 0.10.7",
]
[[package]] [[package]]
name = "fluence-it-types" name = "fluence-it-types"
version = "0.4.1" version = "0.4.1"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -20,9 +20,12 @@ thiserror = "1.0.49"
# beware: `digest` version should match one of the used in particular hash crates # beware: `digest` version should match one of the used in particular hash crates
digest = "0.10.7" digest = "0.10.7"
sha2 = "0.10.7" sha2 = "0.10.7"
blake3 = { version = "1.5.0", features = ["traits-preview"] } fluence-blake3 = { version = "1.5.0", features = ["traits-preview"] }
multihash-codetable = { version = "0.1.1", features = ["blake3", "sha2", "digest"] } multihash-codetable = { version = "0.1.1", features = ["blake3", "sha2", "digest"] }
rkyv = { version = "0.7.43", features = ["validation", "strict"], optional = true } rkyv = { version = "0.7.43", features = ["validation", "strict"], optional = true }
[dev-dependencies] [dev-dependencies]
multihash-codetable = { version = "0.1.1", features = ["ripemd"] } multihash-codetable = { version = "0.1.1", features = ["ripemd"] }
[target.'cfg(target_arch = "wasm32")'.dependencies]
fluence-blake3 = { version = "1.5.0", features = ["traits-preview", "wasm32_simd"] }

View File

@ -30,6 +30,7 @@ mod verify;
pub use crate::verify::{verify_raw_value, verify_value, CidVerificationError}; pub use crate::verify::{verify_raw_value, verify_value, CidVerificationError};
use fluence_blake3 as blake3;
use serde::Deserialize; use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use thiserror::Error as ThisError; use thiserror::Error as ThisError;

View File

@ -16,6 +16,7 @@
use crate::{value_json_hash, CidRef, CID, JSON_CODEC}; use crate::{value_json_hash, CidRef, CID, JSON_CODEC};
use fluence_blake3 as blake3;
use serde::Serialize; use serde::Serialize;
use thiserror::Error as ThisError; use thiserror::Error as ThisError;