github.com/Finschia/finschia-sdk@v0.48.1/crypto/keys/secp256k1/bench_test.go (about)

     1  package secp256k1
     2  
     3  import (
     4  	"io"
     5  	"testing"
     6  
     7  	"github.com/Finschia/finschia-sdk/crypto/keys/internal/benchmarking"
     8  	"github.com/Finschia/finschia-sdk/crypto/types"
     9  )
    10  
    11  func BenchmarkKeyGeneration(b *testing.B) {
    12  	b.ReportAllocs()
    13  	benchmarkKeygenWrapper := func(reader io.Reader) types.PrivKey {
    14  		priv := genPrivKey(reader)
    15  		return &PrivKey{Key: priv}
    16  	}
    17  	benchmarking.BenchmarkKeyGeneration(b, benchmarkKeygenWrapper)
    18  }
    19  
    20  func BenchmarkSigning(b *testing.B) {
    21  	b.ReportAllocs()
    22  	priv := GenPrivKey()
    23  	benchmarking.BenchmarkSigning(b, priv)
    24  }
    25  
    26  func BenchmarkVerification(b *testing.B) {
    27  	b.ReportAllocs()
    28  	priv := GenPrivKey()
    29  	benchmarking.BenchmarkVerification(b, priv)
    30  }