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

crypto: benchmark BLS single signing and verification #1881

Merged
merged 3 commits into from
Jun 8, 2020

Conversation

AdoAdoAdo
Copy link
Contributor

@AdoAdoAdo AdoAdoAdo commented Jun 8, 2020

go test crypto/signing/mcl/singlesig/bls_bench_test.go -bench BlsSingleSigner

i7 7th gen
BenchmarkBlsSingleSigner_Sign-4 3208 401445 ns/op
BenchmarkBlsSingleSigner_Verify-4 870 1628854 ns/op

@LucianMincu
Copy link
Contributor

Arm64 Rasp Pi 4

go test crypto/signing/mcl/singlesig/bls_bench_test.go -bench BlsSingleSigner
goos: linux
goarch: arm64
BenchmarkBlsSingleSigner_Sign-4     	     704	   1711463 ns/op
BenchmarkBlsSingleSigner_Verify-4   	     140	   8492564 ns/op
PASS
ok  	command-line-arguments	54.556s

Copy link
Contributor

@iulianpascalau iulianpascalau left a comment

Choose a reason for hiding this comment

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

On an i3 - gen3 2 cores, 4 logical CPUs I've got:

BenchmarkBlsSingleSigner_Sign     - 456.536 uS/op
BenchmarkBlsSingleSigner_Verify   -   2.327 ms/op

On an i5 - gen4 2 cores, 4 logical CPUs I've got:

BenchmarkBlsSingleSigner_Sign     - 445.511 uS/op
BenchmarkBlsSingleSigner_Verify   -   2.255 ms/op

Copy link
Collaborator

@andreibancioiu andreibancioiu left a comment

Choose a reason for hiding this comment

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

Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz

goos: linux
goarch: amd64
BenchmarkBlsSingleSigner_Sign-4             4172            372616 ns/op
BenchmarkBlsSingleSigner_Verify-4            984           1222218 ns/op
PASS
ok      command-line-arguments  11.518s


var err error
nbMessages := 10000
messages := make([][]byte, 0, 10000)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could have used nbMessages.


b.ResetTimer()
for i := 0; i < b.N; i++ {
_, err = signer.Sign(privKey, messages[i%nbMessages])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Messages to sign are quite short. Maybe relevant to the benchmark?


var err error
nbMessages := 10000
messages := make([][]byte, 0, 10000)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could have used nbMessages.


b.ResetTimer()
for i := 0; i < b.N; i++ {
err = signer.Verify(pubKey, messages[i%nbMessages], signatures[i%nbMessages])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Messages to verify are a bit short (see above).

Copy link
Contributor

@LucianMincu LucianMincu left a comment

Choose a reason for hiding this comment

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

👍

@LucianMincu LucianMincu merged commit 40740aa into development Jun 8, 2020
@LucianMincu LucianMincu deleted the bench-single-bls-signature branch June 8, 2020 12:26
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.

None yet

4 participants