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
529 B

  1. package pex
  2. import (
  3. "testing"
  4. "github.com/tendermint/tendermint/types"
  5. )
  6. func BenchmarkAddrBook_hash(b *testing.B) {
  7. book := &addrBook{
  8. ourAddrs: make(map[string]struct{}),
  9. privateIDs: make(map[types.NodeID]struct{}),
  10. addrLookup: make(map[types.NodeID]*knownAddress),
  11. badPeers: make(map[types.NodeID]*knownAddress),
  12. filePath: "",
  13. routabilityStrict: true,
  14. }
  15. book.init()
  16. msg := []byte(`foobar`)
  17. b.ResetTimer()
  18. for i := 0; i < b.N; i++ {
  19. _, _ = book.hash(msg)
  20. }
  21. }