Skip to content

Commit

Permalink
Multi pairing bench (#673)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmagician committed Sep 4, 2023
1 parent 829430d commit 10acb5c
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions bench-templates/src/macros/pairing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,27 @@ macro_rules! pairing_bench {
})
},
);
pairing.bench_function(&format!("Full Pairing for {}", stringify!($curve)), |b| {
b.iter(|| {
i = (i + 1) % SAMPLES;
<$curve as Pairing>::multi_pairing([g1s[i]], [g2s[i]])
})
});

const NUM_PAIRS: usize = 10;

for pairs in 1..=NUM_PAIRS {
pairing.bench_function(
&format!(
"Multi Pairing for {} with {} pairs",
stringify!($curve),
pairs
),
|b| {
b.iter(|| {
i = (i + 1) % (SAMPLES - NUM_PAIRS);
<$curve as Pairing>::multi_pairing(
g1s[(i)..(i + pairs)].to_vec(),
g2s[(i)..(i + pairs)].to_vec(),
)
})
},
);
}
}

$crate::criterion_group!(benches, pairing);
Expand Down

0 comments on commit 10acb5c

Please sign in to comment.