Skip to content

Commit 6b859d6

Browse files
committed
preallocate map in sameAddrs
1 parent b17ba31 commit 6b859d6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

p2p/host/basic/basic_host.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ func sameAddrs(a, b []ma.Multiaddr) bool {
323323
return false
324324
}
325325

326-
bmap := make(map[string]struct{})
326+
bmap := make(map[string]struct{}, len(b))
327327
for _, addr := range b {
328328
bmap[string(addr.Bytes())] = struct{}{}
329329
}

0 commit comments

Comments
 (0)