2020-08-18 06:53:40 -07:00
|
|
|
package secp256k1
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/cosmos/cosmos-sdk/crypto/keys/internal/benchmarking"
|
2020-11-09 08:01:43 -08:00
|
|
|
"github.com/cosmos/cosmos-sdk/crypto/types"
|
2020-08-18 06:53:40 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
func BenchmarkKeyGeneration(b *testing.B) {
|
2021-01-27 23:52:08 -08:00
|
|
|
b.ReportAllocs()
|
2020-11-09 08:01:43 -08:00
|
|
|
benchmarkKeygenWrapper := func(reader io.Reader) types.PrivKey {
|
2020-09-16 04:08:55 -07:00
|
|
|
priv := genPrivKey(reader)
|
|
|
|
return &PrivKey{Key: priv}
|
2020-08-18 06:53:40 -07:00
|
|
|
}
|
|
|
|
benchmarking.BenchmarkKeyGeneration(b, benchmarkKeygenWrapper)
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkSigning(b *testing.B) {
|
2021-01-27 23:52:08 -08:00
|
|
|
b.ReportAllocs()
|
2020-08-18 06:53:40 -07:00
|
|
|
priv := GenPrivKey()
|
|
|
|
benchmarking.BenchmarkSigning(b, priv)
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkVerification(b *testing.B) {
|
2021-01-27 23:52:08 -08:00
|
|
|
b.ReportAllocs()
|
2020-08-18 06:53:40 -07:00
|
|
|
priv := GenPrivKey()
|
|
|
|
benchmarking.BenchmarkVerification(b, priv)
|
|
|
|
}
|