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

secp256k1: Implement direct signature verification. #2058

Merged

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Feb 1, 2020

This requires PR #2057.

This implements signature verification directly instead of calling the version in the standard library in order to ultimately be able to break the reliance on big ints it requires and thus allow for optimization specifically for the sec256k1 curve.

It currently is only marginally faster since it still relies on big ints. However, there is already a 10% reduction in allocations which reduces pressure on the GC during IBD when there are a ton of signature verifications happening.

benchmark            old ns/op    new ns/op    delta
-----------------------------------------------------
BenchmarkSigVerify   224238       219603       -2.07%

benchmark            old allocs   new allocs   delta
-----------------------------------------------------
BenchmarkSigVerify   64           57           -10.94%

benchmark            old bytes    new bytes    delta
-----------------------------------------------------
BenchmarkSigVerify   3138         2818         -10.20%

@davecgh davecgh added this to the 1.6.0 milestone Feb 1, 2020
@davecgh davecgh changed the title Secp2561k implement direct sig verify secp256k1: Implement direct signature verification. Feb 1, 2020
Copy link
Member

@matheusd matheusd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit msg has "... for the sec256k1 curve ..." (sec256k1 => secp256k1)

dcrec/secp256k1/signature.go Outdated Show resolved Hide resolved
dcrec/secp256k1/signature.go Outdated Show resolved Hide resolved
@davecgh davecgh force-pushed the secp2561k_implement_direct_sig_verify branch from dccfabd to 6844861 Compare February 3, 2020 23:55
This implements signature verification directly instead of calling the
version in the standard library in order to ultimately be able to break
the reliance on big ints it requires and thus allow for optimization
specifically for the sec256k1 curve.

It currently is only marginally faster since it still relies on big
ints.  However, there is already a 10% reduction in allocations which
reduces pressure on the GC during IBD when there are a ton of signature
verifications happening.

benchmark            old ns/op    new ns/op    delta
-----------------------------------------------------
BenchmarkSigVerify   224238       219603       -2.07%

benchmark            old allocs   new allocs   delta
-----------------------------------------------------
BenchmarkSigVerify   64           57           -10.94%

benchmark            old bytes    new bytes    delta
-----------------------------------------------------
BenchmarkSigVerify   3138         2818         -10.20%
@davecgh davecgh force-pushed the secp2561k_implement_direct_sig_verify branch from 6844861 to a891117 Compare February 11, 2020 04:56
@davecgh davecgh merged commit a891117 into decred:master Feb 12, 2020
@davecgh davecgh deleted the secp2561k_implement_direct_sig_verify branch February 12, 2020 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants