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

Improve secp256k1 field multiplication speeds #24

Closed
tuxxy opened this issue Apr 29, 2020 · 5 comments
Closed

Improve secp256k1 field multiplication speeds #24

tuxxy opened this issue Apr 29, 2020 · 5 comments
Labels
k256 secp256k1 crate

Comments

@tuxxy
Copy link
Contributor

tuxxy commented Apr 29, 2020

Presently, the k256 crate implements montgomery mulmod for multiplication/reduction. @hdevalence brought up a point in #19 that there may be a method that leverages the special form of the secp256k1 modulus to improve multiplication performance.

Performance of a scalar multiplication for the k256 crate:

test tests::k256_scalar_mul    ... bench:     197,252 ns/iter (+/- 2,838)

It would be nice to see a significant performance increase for this.

@tarcieri
Copy link
Member

@tuxxy would you consider this addressed by #59?

@tuxxy
Copy link
Contributor Author

tuxxy commented Jul 15, 2020

Not quite. I'd like to write some benchmarks for myself and talk with @fjarri a bit before it gets closed.

@fjarri
Copy link
Contributor

fjarri commented Jul 15, 2020

What multiplication are we talking about here? Scalar-scalar, field-field, or point-scalar? The latter can certainly be improved, I'm planning to look into it.

Where's this benchmark you're quoting, by the way?

@tuxxy
Copy link
Contributor Author

tuxxy commented Jul 15, 2020

I've unfortunately lost the benchmark I originally wrote, but it measured point-scalar. It would be nice to see two benchmarks, 1) comparing point-scalar operations to libsecp256k1 and 2) measuring scalar-scalar operations (maybe against a variety of implementations?).

@tarcieri
Copy link
Member

I think we can go ahead and close this out. Further optimizations would certainly be appreciated, but I think we're ok for now.

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

No branches or pull requests

3 participants