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

Feat: benchmark: 30000 TPS with completely fresh transactions

parent cf1d886f
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,10 @@ import (
)
func BenchmarkVerifySignature(b *testing.B) {
transaction := transaction.New(transaction.EmptyId, transaction.EmptyId, identity.Generate(), data.New([]byte("test")))
transactions := make([]*transaction.Transaction, b.N)
for i := 0; i < b.N; i++ {
transactions[i] = transaction.New(transaction.EmptyId, transaction.EmptyId, identity.Generate(), data.New([]byte("test")))
}
var wg sync.WaitGroup
......@@ -28,11 +31,14 @@ func BenchmarkVerifySignature(b *testing.B) {
for i := 0; i < b.N; i++ {
wg.Add(1)
ants.Submit(func() {
transaction.VerifySignature()
currentIndex := i
if err := ants.Submit(func() {
transactions[currentIndex].VerifySignature()
wg.Done()
})
}); err != nil {
b.Error(err)
}
}
wg.Wait()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment