Skip to content

Commit

Permalink
Measure the size of the multiexp tables
Browse files Browse the repository at this point in the history
  • Loading branch information
survived committed Sep 22, 2023
1 parent 67d8cf0 commit 58ecdfe
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cggmp21/src/key_share.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,20 @@ impl<L: SecurityLevel> DirtyAuxInfo<L> {

Ok(())
}

/// Returns size of all multiexp tables (in bytes) stored within key share
pub fn multiexp_tables_size(&self) -> usize {
self.parties
.iter()
.map(|aux_i| {
aux_i
.multiexp
.as_ref()
.map(|t| t.size_in_bytes())
.unwrap_or(0)
})
.sum()
}
}

impl<E: Curve, L: SecurityLevel> DirtyKeyShare<E, L> {
Expand Down
8 changes: 8 additions & 0 deletions tests/src/bin/measure_perf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,14 @@ async fn do_becnhmarks<L: SecurityLevel>(args: Args) {
let took = std::time::Instant::now().duration_since(start);

println!("Precompute multiexp tables (avg): {:?}", took / n.into());
println!(
"Size of multiexp tables per key share: {} bytes",
aux_data[0].multiexp_tables_size()
);
println!(
"Size of exponents: {:?}",
cggmp21::security_level::max_exponents_size::<L>()
);
println!();
}

Expand Down

0 comments on commit 58ecdfe

Please sign in to comment.