mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 09:37:38 +00:00
e3: don't put nil to pool (#6219)
This commit is contained in:
parent
bdc9da0162
commit
12ee33a492
@ -212,14 +212,10 @@ func (rs *State22) queuePush(t *exec22.TxTask) {
|
||||
|
||||
func (rs *State22) AddWork(txTask *exec22.TxTask) {
|
||||
txTask.BalanceIncreaseSet = nil
|
||||
if txTask.ReadLists != nil {
|
||||
returnReadList(txTask.ReadLists)
|
||||
txTask.ReadLists = nil
|
||||
}
|
||||
if txTask.WriteLists != nil {
|
||||
returnWriteList(txTask.WriteLists)
|
||||
txTask.WriteLists = nil
|
||||
}
|
||||
returnReadList(txTask.ReadLists)
|
||||
txTask.ReadLists = nil
|
||||
returnWriteList(txTask.WriteLists)
|
||||
txTask.WriteLists = nil
|
||||
txTask.ResultsSize = 0
|
||||
txTask.Logs = nil
|
||||
txTask.TraceFroms = nil
|
||||
@ -862,13 +858,18 @@ var writeListPool = sync.Pool{
|
||||
}
|
||||
|
||||
func newWriteList() map[string]*exec22.KvList {
|
||||
w := writeListPool.Get().(map[string]*exec22.KvList)
|
||||
for _, tbl := range w {
|
||||
v := writeListPool.Get().(map[string]*exec22.KvList)
|
||||
for _, tbl := range v {
|
||||
tbl.Keys, tbl.Vals = tbl.Keys[:0], tbl.Vals[:0]
|
||||
}
|
||||
return w
|
||||
return v
|
||||
}
|
||||
func returnWriteList(v map[string]*exec22.KvList) {
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
writeListPool.Put(v)
|
||||
}
|
||||
func returnWriteList(w map[string]*exec22.KvList) { writeListPool.Put(w) }
|
||||
|
||||
var readListPool = sync.Pool{
|
||||
New: func() any {
|
||||
@ -882,10 +883,15 @@ var readListPool = sync.Pool{
|
||||
}
|
||||
|
||||
func newReadList() map[string]*exec22.KvList {
|
||||
w := readListPool.Get().(map[string]*exec22.KvList)
|
||||
for _, tbl := range w {
|
||||
v := readListPool.Get().(map[string]*exec22.KvList)
|
||||
for _, tbl := range v {
|
||||
tbl.Keys, tbl.Vals = tbl.Keys[:0], tbl.Vals[:0]
|
||||
}
|
||||
return w
|
||||
return v
|
||||
}
|
||||
func returnReadList(v map[string]*exec22.KvList) {
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
readListPool.Put(v)
|
||||
}
|
||||
func returnReadList(w map[string]*exec22.KvList) { readListPool.Put(w) }
|
||||
|
Loading…
Reference in New Issue
Block a user