mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 00:41:03 +00:00
Switch to the blake2b_simd crate in sp-core-hashing (#13548)
* Switch to the `blake2b_simd` crate in `sp-core-hashing` * ".git/.scripts/commands/bench/bench.sh" pallet dev frame_benchmarking --------- Co-authored-by: command-bot <>
This commit is contained in:
Generated
+2
-2
@@ -10193,7 +10193,7 @@ dependencies = [
|
|||||||
name = "sp-core-hashing"
|
name = "sp-core-hashing"
|
||||||
version = "5.0.0"
|
version = "5.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"blake2",
|
"blake2b_simd",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"digest 0.10.6",
|
"digest 0.10.6",
|
||||||
"sha2 0.10.6",
|
"sha2 0.10.6",
|
||||||
@@ -11775,7 +11775,7 @@ checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"digest 0.10.6",
|
"digest 0.10.6",
|
||||||
"rand 0.7.3",
|
"rand 0.8.5",
|
||||||
"static_assertions",
|
"static_assertions",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -18,25 +18,26 @@
|
|||||||
//! Autogenerated weights for frame_benchmarking
|
//! Autogenerated weights for frame_benchmarking
|
||||||
//!
|
//!
|
||||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||||
//! DATE: 2023-01-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
//! DATE: 2023-03-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||||
//! WORST CASE MAP SIZE: `1000000`
|
//! WORST CASE MAP SIZE: `1000000`
|
||||||
//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
|
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
|
||||||
|
|
||||||
// Executed Command:
|
// Executed Command:
|
||||||
// ./target/production/substrate
|
// target/production/substrate
|
||||||
// benchmark
|
// benchmark
|
||||||
// pallet
|
// pallet
|
||||||
// --chain=dev
|
|
||||||
// --steps=50
|
// --steps=50
|
||||||
// --repeat=20
|
// --repeat=20
|
||||||
// --pallet=frame_benchmarking
|
|
||||||
// --extrinsic=*
|
// --extrinsic=*
|
||||||
// --execution=wasm
|
// --execution=wasm
|
||||||
// --wasm-execution=compiled
|
// --wasm-execution=compiled
|
||||||
// --heap-pages=4096
|
// --heap-pages=4096
|
||||||
// --output=./frame/benchmarking/src/weights.rs
|
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/substrate/.git/.artifacts/bench.json
|
||||||
|
// --pallet=frame_benchmarking
|
||||||
|
// --chain=dev
|
||||||
// --header=./HEADER-APACHE2
|
// --header=./HEADER-APACHE2
|
||||||
|
// --output=./frame/benchmarking/src/weights.rs
|
||||||
// --template=./.maintain/frame-weight-template.hbs
|
// --template=./.maintain/frame-weight-template.hbs
|
||||||
|
|
||||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
@@ -64,49 +65,49 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
|||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 138 nanoseconds.
|
// Minimum execution time: 168_000 picoseconds.
|
||||||
Weight::from_parts(199_805, 0)
|
Weight::from_parts(237_577, 0)
|
||||||
}
|
}
|
||||||
/// The range of component `i` is `[0, 1000000]`.
|
/// The range of component `i` is `[0, 1000000]`.
|
||||||
fn subtraction(_i: u32, ) -> Weight {
|
fn subtraction(_i: u32, ) -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 142 nanoseconds.
|
// Minimum execution time: 169_000 picoseconds.
|
||||||
Weight::from_parts(201_435, 0)
|
Weight::from_parts(224_111, 0)
|
||||||
}
|
}
|
||||||
/// The range of component `i` is `[0, 1000000]`.
|
/// The range of component `i` is `[0, 1000000]`.
|
||||||
fn multiplication(_i: u32, ) -> Weight {
|
fn multiplication(_i: u32, ) -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 138 nanoseconds.
|
// Minimum execution time: 175_000 picoseconds.
|
||||||
Weight::from_parts(207_037, 0)
|
Weight::from_parts(229_708, 0)
|
||||||
}
|
}
|
||||||
/// The range of component `i` is `[0, 1000000]`.
|
/// The range of component `i` is `[0, 1000000]`.
|
||||||
fn division(_i: u32, ) -> Weight {
|
fn division(_i: u32, ) -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 151 nanoseconds.
|
// Minimum execution time: 173_000 picoseconds.
|
||||||
Weight::from_parts(205_150, 0)
|
Weight::from_parts(229_855, 0)
|
||||||
}
|
}
|
||||||
fn hashing() -> Weight {
|
fn hashing() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 21_950_884 nanoseconds.
|
// Minimum execution time: 21_286_627_000 picoseconds.
|
||||||
Weight::from_parts(21_994_001_000, 0)
|
Weight::from_parts(21_405_011_000, 0)
|
||||||
}
|
}
|
||||||
/// The range of component `i` is `[0, 100]`.
|
/// The range of component `i` is `[0, 100]`.
|
||||||
fn sr25519_verification(i: u32, ) -> Weight {
|
fn sr25519_verification(i: u32, ) -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 168 nanoseconds.
|
// Minimum execution time: 239_000 picoseconds.
|
||||||
Weight::from_parts(1_680_898, 0)
|
Weight::from_parts(661_987, 0)
|
||||||
// Standard Error: 10_291
|
// Standard Error: 24_324
|
||||||
.saturating_add(Weight::from_parts(46_867_301, 0).saturating_mul(i.into()))
|
.saturating_add(Weight::from_parts(47_322_399, 0).saturating_mul(i.into()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,48 +118,48 @@ impl WeightInfo for () {
|
|||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 138 nanoseconds.
|
// Minimum execution time: 168_000 picoseconds.
|
||||||
Weight::from_parts(199_805, 0)
|
Weight::from_parts(237_577, 0)
|
||||||
}
|
}
|
||||||
/// The range of component `i` is `[0, 1000000]`.
|
/// The range of component `i` is `[0, 1000000]`.
|
||||||
fn subtraction(_i: u32, ) -> Weight {
|
fn subtraction(_i: u32, ) -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 142 nanoseconds.
|
// Minimum execution time: 169_000 picoseconds.
|
||||||
Weight::from_parts(201_435, 0)
|
Weight::from_parts(224_111, 0)
|
||||||
}
|
}
|
||||||
/// The range of component `i` is `[0, 1000000]`.
|
/// The range of component `i` is `[0, 1000000]`.
|
||||||
fn multiplication(_i: u32, ) -> Weight {
|
fn multiplication(_i: u32, ) -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 138 nanoseconds.
|
// Minimum execution time: 175_000 picoseconds.
|
||||||
Weight::from_parts(207_037, 0)
|
Weight::from_parts(229_708, 0)
|
||||||
}
|
}
|
||||||
/// The range of component `i` is `[0, 1000000]`.
|
/// The range of component `i` is `[0, 1000000]`.
|
||||||
fn division(_i: u32, ) -> Weight {
|
fn division(_i: u32, ) -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 151 nanoseconds.
|
// Minimum execution time: 173_000 picoseconds.
|
||||||
Weight::from_parts(205_150, 0)
|
Weight::from_parts(229_855, 0)
|
||||||
}
|
}
|
||||||
fn hashing() -> Weight {
|
fn hashing() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 21_950_884 nanoseconds.
|
// Minimum execution time: 21_286_627_000 picoseconds.
|
||||||
Weight::from_parts(21_994_001_000, 0)
|
Weight::from_parts(21_405_011_000, 0)
|
||||||
}
|
}
|
||||||
/// The range of component `i` is `[0, 100]`.
|
/// The range of component `i` is `[0, 100]`.
|
||||||
fn sr25519_verification(i: u32, ) -> Weight {
|
fn sr25519_verification(i: u32, ) -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 168 nanoseconds.
|
// Minimum execution time: 239_000 picoseconds.
|
||||||
Weight::from_parts(1_680_898, 0)
|
Weight::from_parts(661_987, 0)
|
||||||
// Standard Error: 10_291
|
// Standard Error: 24_324
|
||||||
.saturating_add(Weight::from_parts(46_867_301, 0).saturating_mul(i.into()))
|
.saturating_add(Weight::from_parts(47_322_399, 0).saturating_mul(i.into()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ documentation = "https://docs.rs/sp-core-hashing"
|
|||||||
targets = ["x86_64-unknown-linux-gnu"]
|
targets = ["x86_64-unknown-linux-gnu"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
blake2 = { version = "0.10.4", default-features = false }
|
blake2b_simd = { version = "1.0.1", default-features = false }
|
||||||
byteorder = { version = "1.3.2", default-features = false }
|
byteorder = { version = "1.3.2", default-features = false }
|
||||||
digest = { version = "0.10.3", default-features = false }
|
digest = { version = "0.10.3", default-features = false }
|
||||||
sha2 = { version = "0.10.2", default-features = false }
|
sha2 = { version = "0.10.2", default-features = false }
|
||||||
@@ -25,7 +25,7 @@ sp-std = { version = "5.0.0", default-features = false, path = "../../std" }
|
|||||||
default = ["std"]
|
default = ["std"]
|
||||||
std = [
|
std = [
|
||||||
"digest/std",
|
"digest/std",
|
||||||
"blake2/std",
|
"blake2b_simd/std",
|
||||||
"byteorder/std",
|
"byteorder/std",
|
||||||
"sha2/std",
|
"sha2/std",
|
||||||
"sha3/std",
|
"sha3/std",
|
||||||
|
|||||||
@@ -23,34 +23,41 @@
|
|||||||
use core::hash::Hasher;
|
use core::hash::Hasher;
|
||||||
|
|
||||||
use byteorder::{ByteOrder, LittleEndian};
|
use byteorder::{ByteOrder, LittleEndian};
|
||||||
use digest::{
|
use digest::Digest;
|
||||||
consts::{U16, U32, U8},
|
|
||||||
Digest,
|
#[inline(always)]
|
||||||
};
|
fn blake2<const N: usize>(data: &[u8]) -> [u8; N] {
|
||||||
|
blake2b_simd::Params::new()
|
||||||
|
.hash_length(N)
|
||||||
|
.hash(data)
|
||||||
|
.as_bytes()
|
||||||
|
.try_into()
|
||||||
|
.expect("slice is always the necessary length")
|
||||||
|
}
|
||||||
|
|
||||||
/// Do a Blake2 512-bit hash and place result in `dest`.
|
/// Do a Blake2 512-bit hash and place result in `dest`.
|
||||||
pub fn blake2_512_into(data: &[u8], dest: &mut [u8; 64]) {
|
pub fn blake2_512_into(data: &[u8], dest: &mut [u8; 64]) {
|
||||||
dest.copy_from_slice(blake2::Blake2b512::digest(data).as_slice());
|
*dest = blake2(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Do a Blake2 512-bit hash and return result.
|
/// Do a Blake2 512-bit hash and return result.
|
||||||
pub fn blake2_512(data: &[u8]) -> [u8; 64] {
|
pub fn blake2_512(data: &[u8]) -> [u8; 64] {
|
||||||
blake2::Blake2b512::digest(data).into()
|
blake2(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Do a Blake2 256-bit hash and return result.
|
/// Do a Blake2 256-bit hash and return result.
|
||||||
pub fn blake2_256(data: &[u8]) -> [u8; 32] {
|
pub fn blake2_256(data: &[u8]) -> [u8; 32] {
|
||||||
blake2::Blake2b::<U32>::digest(data).into()
|
blake2(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Do a Blake2 128-bit hash and return result.
|
/// Do a Blake2 128-bit hash and return result.
|
||||||
pub fn blake2_128(data: &[u8]) -> [u8; 16] {
|
pub fn blake2_128(data: &[u8]) -> [u8; 16] {
|
||||||
blake2::Blake2b::<U16>::digest(data).into()
|
blake2(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Do a Blake2 64-bit hash and return result.
|
/// Do a Blake2 64-bit hash and return result.
|
||||||
pub fn blake2_64(data: &[u8]) -> [u8; 8] {
|
pub fn blake2_64(data: &[u8]) -> [u8; 8] {
|
||||||
blake2::Blake2b::<U8>::digest(data).into()
|
blake2(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Do a XX 64-bit hash and place result in `dest`.
|
/// Do a XX 64-bit hash and place result in `dest`.
|
||||||
|
|||||||
Reference in New Issue
Block a user