Benchmark hash + to bn255

This commit is contained in:
alrevuelta 2024-02-27 13:58:39 +01:00
parent 14960f3aff
commit 247acba21d
No known key found for this signature in database
GPG Key ID: F345C9F3CCDB886E
1 changed files with 13 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package rln
import (
"bytes"
"fmt"
"math/big"
"testing"
@ -51,3 +52,15 @@ func TestHashToBN255(t *testing.T) {
[32]byte{69, 7, 140, 46, 26, 131, 147, 30, 161, 68, 2, 5, 234, 195, 227, 223, 119, 187, 116, 97, 153, 70, 71, 254, 60, 149, 54, 109, 77, 79, 105, 20},
out)
}
func BenchmarkHashToBN255(b *testing.B) {
msgSizedInKB := []int{2, 25, 100, 500}
for _, size := range msgSizedInKB {
data := make([]byte, size*1024)
b.Run(fmt.Sprintf("%dKBytes", size), func(b *testing.B) {
for i := 0; i < b.N; i++ {
HashToBN255(data)
}
})
}
}