diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /third_party/rust/prio/benches/cycle_counts.rs | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/prio/benches/cycle_counts.rs')
-rw-r--r-- | third_party/rust/prio/benches/cycle_counts.rs | 63 |
1 files changed, 21 insertions, 42 deletions
diff --git a/third_party/rust/prio/benches/cycle_counts.rs b/third_party/rust/prio/benches/cycle_counts.rs index 43a4ccdad0..5ab704cd44 100644 --- a/third_party/rust/prio/benches/cycle_counts.rs +++ b/third_party/rust/prio/benches/cycle_counts.rs @@ -5,15 +5,12 @@ use iai::black_box; #[cfg(feature = "experimental")] use prio::{ codec::{Decode, Encode, ParameterizedDecode}, - field::{Field255, FieldElement}, + field::{Field255, FieldElement, FieldPrio2}, idpf::{Idpf, IdpfInput, IdpfPublicShare, RingBufferCache}, - vdaf::{poplar1::Poplar1IdpfValue, xof::Seed}, -}; -#[cfg(feature = "prio2")] -use prio::{ - field::FieldPrio2, vdaf::{ + poplar1::Poplar1IdpfValue, prio2::{Prio2, Prio2PrepareShare}, + xof::Seed, Aggregator, Share, }, }; @@ -45,7 +42,7 @@ fn prng_4096() -> Vec<Field128> { prng(4096) } -#[cfg(feature = "prio2")] +#[cfg(feature = "experimental")] fn prio2_client(size: usize) -> Vec<Share<FieldPrio2, 32>> { let prio2 = Prio2::new(size).unwrap(); let input = vec![0u32; size]; @@ -53,22 +50,22 @@ fn prio2_client(size: usize) -> Vec<Share<FieldPrio2, 32>> { prio2.shard(&black_box(input), &black_box(nonce)).unwrap().1 } -#[cfg(feature = "prio2")] +#[cfg(feature = "experimental")] fn prio2_client_10() -> Vec<Share<FieldPrio2, 32>> { prio2_client(10) } -#[cfg(feature = "prio2")] +#[cfg(feature = "experimental")] fn prio2_client_100() -> Vec<Share<FieldPrio2, 32>> { prio2_client(100) } -#[cfg(feature = "prio2")] +#[cfg(feature = "experimental")] fn prio2_client_1000() -> Vec<Share<FieldPrio2, 32>> { prio2_client(1000) } -#[cfg(feature = "prio2")] +#[cfg(feature = "experimental")] fn prio2_shard_and_prepare(size: usize) -> Prio2PrepareShare { let prio2 = Prio2::new(size).unwrap(); let input = vec![0u32; size]; @@ -80,24 +77,24 @@ fn prio2_shard_and_prepare(size: usize) -> Prio2PrepareShare { .1 } -#[cfg(feature = "prio2")] +#[cfg(feature = "experimental")] fn prio2_shard_and_prepare_10() -> Prio2PrepareShare { prio2_shard_and_prepare(10) } -#[cfg(feature = "prio2")] +#[cfg(feature = "experimental")] fn prio2_shard_and_prepare_100() -> Prio2PrepareShare { prio2_shard_and_prepare(100) } -#[cfg(feature = "prio2")] +#[cfg(feature = "experimental")] fn prio2_shard_and_prepare_1000() -> Prio2PrepareShare { prio2_shard_and_prepare(1000) } fn prio3_client_count() -> Vec<Prio3InputShare<Field64, 16>> { let prio3 = Prio3::new_count(2).unwrap(); - let measurement = 1; + let measurement = true; let nonce = [0; 16]; prio3 .shard(&black_box(measurement), &black_box(nonce)) @@ -241,7 +238,7 @@ fn idpf_codec() { .unwrap(); let bits = 4; let public_share = IdpfPublicShare::<Poplar1IdpfValue<Field64>, Poplar1IdpfValue<Field255>>::get_decoded_with_param(&bits, &data).unwrap(); - let encoded = public_share.get_encoded(); + let encoded = public_share.get_encoded().unwrap(); let _ = black_box(encoded.len()); } @@ -261,34 +258,10 @@ macro_rules! main_base { }; } -#[cfg(feature = "prio2")] -macro_rules! main_add_prio2 { - ( $( $func_name:ident ),* $(,)* ) => { - main_base!( - prio2_client_10, - prio2_client_100, - prio2_client_1000, - prio2_shard_and_prepare_10, - prio2_shard_and_prepare_100, - prio2_shard_and_prepare_1000, - $( $func_name, )* - ); - }; -} - -#[cfg(not(feature = "prio2"))] -macro_rules! main_add_prio2 { - ( $( $func_name:ident ),* $(,)* ) => { - main_base!( - $( $func_name, )* - ); - }; -} - #[cfg(feature = "multithreaded")] macro_rules! main_add_multithreaded { ( $( $func_name:ident ),* $(,)* ) => { - main_add_prio2!( + main_base!( prio3_client_count_vec_multithreaded_1000, $( $func_name, )* ); @@ -298,7 +271,7 @@ macro_rules! main_add_multithreaded { #[cfg(not(feature = "multithreaded"))] macro_rules! main_add_multithreaded { ( $( $func_name:ident ),* $(,)* ) => { - main_add_prio2!( + main_base!( $( $func_name, )* ); }; @@ -308,6 +281,12 @@ macro_rules! main_add_multithreaded { macro_rules! main_add_experimental { ( $( $func_name:ident ),* $(,)* ) => { main_add_multithreaded!( + prio2_client_10, + prio2_client_100, + prio2_client_1000, + prio2_shard_and_prepare_10, + prio2_shard_and_prepare_100, + prio2_shard_and_prepare_1000, idpf_codec, idpf_poplar_gen_8, idpf_poplar_gen_128, |