p2p: initialize maps with known size (#27229)

This commit is contained in:
ucwong
2023-05-10 10:52:26 +02:00
committed by GitHub
parent a742943c78
commit ae7db289b8
10 changed files with 13 additions and 13 deletions
+1 -1
View File
@@ -78,7 +78,7 @@ func (it *IPTracker) PredictEndpoint() string {
it.gcStatements(it.clock.Now())
// The current strategy is simple: find the endpoint with most statements.
counts := make(map[string]int)
counts := make(map[string]int, len(it.statements))
maxcount, max := 0, ""
for _, s := range it.statements {
c := counts[s.endpoint] + 1