You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

24 lines
530 B

package pex
import (
"testing"
"github.com/tendermint/tendermint/internal/p2p"
)
func BenchmarkAddrBook_hash(b *testing.B) {
book := &addrBook{
ourAddrs: make(map[string]struct{}),
privateIDs: make(map[p2p.NodeID]struct{}),
addrLookup: make(map[p2p.NodeID]*knownAddress),
badPeers: make(map[p2p.NodeID]*knownAddress),
filePath: "",
routabilityStrict: true,
}
book.init()
msg := []byte(`foobar`)
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, _ = book.hash(msg)
}
}