From cf1d886f9918dfe0fde3790c8013760b5760a445 Mon Sep 17 00:00:00 2001
From: Hans Moog <hm@mkjc.net>
Date: Mon, 23 Dec 2019 01:34:22 +0100
Subject: [PATCH] Feat: added benchmark for signature verification 50000 TPS

---
 .../transaction/test/transaction_test.go      | 23 +++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/packages/binary/transaction/test/transaction_test.go b/packages/binary/transaction/test/transaction_test.go
index 3e195bef..2084b3c7 100644
--- a/packages/binary/transaction/test/transaction_test.go
+++ b/packages/binary/transaction/test/transaction_test.go
@@ -2,8 +2,11 @@ package test
 
 import (
 	"fmt"
+	"sync"
 	"testing"
 
+	"github.com/panjf2000/ants/v2"
+
 	"github.com/iotaledger/goshimmer/packages/ledgerstate/transfer"
 
 	"github.com/iotaledger/goshimmer/packages/binary/transaction"
@@ -15,6 +18,26 @@ import (
 	"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) {
 	newTransaction1 := transaction.New(transaction.EmptyId, transaction.EmptyId, identity.Generate(), data.New([]byte("test")))
 	assert.Equal(t, newTransaction1.VerifySignature(), true)
-- 
GitLab