Skip to content

Commit

Permalink
Only bench valid field elements
Browse files Browse the repository at this point in the history
  • Loading branch information
mikdk committed Jun 24, 2024
1 parent 677fd40 commit 9874b23
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions crates/crypto/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ pub struct Fp([u64; 4]);
// Arkworks
use ark_ff::fields::{Fp256, MontBackend};
use ark_ff::{BigInt, Field, MontConfig};
use rand::Rng;
#[derive(MontConfig)]
#[modulus = "3618502788666131213697322783095070105623107215331596699973092056135872020481"]
#[generator = "3"]
Expand Down Expand Up @@ -46,9 +45,8 @@ pub fn bench_field(c: &mut Criterion) {

let mut grp_alg = c.benchmark_group("field");

let rand: [u64; 4] = [rng.gen(), rng.gen(), rng.gen(), rng.gen()];
let ark_elm = Fq::new_unchecked(BigInt(rand));
let pf_elm = MontFelt::from_native_limbs(rand);
let pf_elm = MontFelt::random(rng);
let ark_elm = Fq::new_unchecked(BigInt(pf_elm.0));
let ff_elm = <Fp as ff::PrimeField>::from_repr(FpRepr(pf_elm.to_be_bytes())).unwrap();

// MUL
Expand Down

0 comments on commit 9874b23

Please sign in to comment.