Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Optimization?] signature key stores affine points #457

Open
mrain opened this issue Jan 12, 2024 · 0 comments
Open

[Optimization?] signature key stores affine points #457

mrain opened this issue Jan 12, 2024 · 0 comments

Comments

@mrain
Copy link
Contributor

mrain commented Jan 12, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant