Skip to content
Snippets Groups Projects
Commit cf1d886f authored by Hans Moog's avatar Hans Moog
Browse files

Feat: added benchmark for signature verification 50000 TPS

parent 016721a1
No related branches found
No related tags found
No related merge requests found
...@@ -2,8 +2,11 @@ package test ...@@ -2,8 +2,11 @@ package test
import ( import (
"fmt" "fmt"
"sync"
"testing" "testing"
"github.com/panjf2000/ants/v2"
"github.com/iotaledger/goshimmer/packages/ledgerstate/transfer" "github.com/iotaledger/goshimmer/packages/ledgerstate/transfer"
"github.com/iotaledger/goshimmer/packages/binary/transaction" "github.com/iotaledger/goshimmer/packages/binary/transaction"
...@@ -15,6 +18,26 @@ import ( ...@@ -15,6 +18,26 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
func BenchmarkVerifySignature(b *testing.B) {
transaction := transaction.New(transaction.EmptyId, transaction.EmptyId, identity.Generate(), data.New([]byte("test")))
var wg sync.WaitGroup
b.ResetTimer()
for i := 0; i < b.N; i++ {
wg.Add(1)
ants.Submit(func() {
transaction.VerifySignature()
wg.Done()
})
}
wg.Wait()
}
func TestNew(t *testing.T) { func TestNew(t *testing.T) {
newTransaction1 := transaction.New(transaction.EmptyId, transaction.EmptyId, identity.Generate(), data.New([]byte("test"))) newTransaction1 := transaction.New(transaction.EmptyId, transaction.EmptyId, identity.Generate(), data.New([]byte("test")))
assert.Equal(t, newTransaction1.VerifySignature(), true) assert.Equal(t, newTransaction1.VerifySignature(), true)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment