jellyfish icon indicating copy to clipboard operation
jellyfish copied to clipboard

[Optimization?] signature key stores affine points

Open mrain opened this issue 1 year ago • 0 comments

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.

mrain avatar Jan 12 '24 17:01 mrain