diff options
author | John Jannotti <jannotti@gmail.com> | 2024-01-17 11:02:26 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-17 11:02:26 -0500 |
commit | bb86c364a77b8aa29ea83985138d8cc297bbb49f (patch) | |
tree | 5015714cb5a9108ee10050e1913416fdfd117aae | |
parent | d383a911847648140e15994d21a151b7cafdce0c (diff) |
API: Make maps the right size from the start (#5906)
-rw-r--r-- | data/pools/statusCache.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/data/pools/statusCache.go b/data/pools/statusCache.go index ed1145193..c8977e3fc 100644 --- a/data/pools/statusCache.go +++ b/data/pools/statusCache.go @@ -52,7 +52,7 @@ func (sc *statusCache) check(txid transactions.Txid) (tx transactions.SignedTxn, func (sc *statusCache) put(tx transactions.SignedTxn, txErr string) { if len(sc.cur) >= sc.sz { sc.prev = sc.cur - sc.cur = map[transactions.Txid]statusCacheEntry{} + sc.cur = make(map[transactions.Txid]statusCacheEntry, sc.sz) } sc.cur[tx.ID()] = statusCacheEntry{ @@ -62,6 +62,6 @@ func (sc *statusCache) put(tx transactions.SignedTxn, txErr string) { } func (sc *statusCache) reset() { - sc.cur = map[transactions.Txid]statusCacheEntry{} - sc.prev = map[transactions.Txid]statusCacheEntry{} + sc.cur = make(map[transactions.Txid]statusCacheEntry, sc.sz) + sc.prev = nil } |