secp256k1: Add compressed pubkey parse benchmark.

This commit is contained in:
Dave Collins 2020-04-08 14:57:36 -05:00
parent 4fc3c02ca0
commit 2f1f4e4ba3
No known key found for this signature in database
GPG Key ID: B8904D9D9C93D1F2

View File

@ -115,3 +115,17 @@ func BenchmarkPubKeyDecompress(b *testing.B) {
_ = DecompressY(pubKeyX, false, &y)
}
}
// BenchmarkParsePubKeyCompressed benchmarks how long it takes to parse a
// compressed public key with an even y coordinate.
func BenchmarkParsePubKeyCompressed(b *testing.B) {
format := "02"
x := "ce0b14fb842b1ba549fdd675c98075f12e9c510f8ef52bd021a9a1f4809d3b4d"
pubKeyBytes := hexToBytes(format + x)
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
ParsePubKey(pubKeyBytes)
}
}