jellyfish
jellyfish copied to clipboard
[Optimization?] signature key stores affine points
In primitives/src/signatures/bls_over_bn254.rs
.
Current Eq
, Ord
of the signature key is making some non-trivial conversion from a projective point to its affine representation.
impl Ord for VerKey {
fn cmp(&self, other: &Self) -> core::cmp::Ordering {
self.0.into_affine().xy().cmp(&other.0.into_affine().xy())
}
}
In case of many expected comparisons and equality checks, e.g. when use the VerKey
to index an BTreeMap
, we could optimize the performance by storing its affine repr by default.