Files
tendermint/mempool/v1/mempool_bench_test.go
Sergio Mena 58effdd8b3 Old PrepareProposal on feature/abci++ppp (#9106)
* [Rebased to v0.34.x] abci: PrepareProposal (#6544)

* fixed cherry-pick

* proto changes

* make proto-gen

* UT fixes

* generate Client directive

* mockery

* App fixes

* Disable 'modified tx' hack

* mockery

* Make format

* Fix lint

Co-authored-by: Marko <marbar3778@yahoo.com>
2022-07-27 15:09:02 +02:00

33 lines
612 B
Go

package v1
import (
"fmt"
"math/rand"
"testing"
"time"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/mempool"
)
func BenchmarkTxMempool_CheckTx(b *testing.B) {
txmp := setup(b, 10000)
rng := rand.New(rand.NewSource(time.Now().UnixNano()))
b.ResetTimer()
for n := 0; n < b.N; n++ {
b.StopTimer()
prefix := make([]byte, 20)
_, err := rng.Read(prefix)
require.NoError(b, err)
priority := int64(rng.Intn(9999-1000) + 1000)
tx := []byte(fmt.Sprintf("%X=%d", prefix, priority))
b.StartTimer()
require.NoError(b, txmp.CheckTx(tx, nil, mempool.TxInfo{}))
}
}