mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-05 10:32:19 +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) {
|
func (rs *State22) AddWork(txTask *exec22.TxTask) {
|
||||||
txTask.BalanceIncreaseSet = nil
|
txTask.BalanceIncreaseSet = nil
|
||||||
if txTask.ReadLists != nil {
|
returnReadList(txTask.ReadLists)
|
||||||
returnReadList(txTask.ReadLists)
|
txTask.ReadLists = nil
|
||||||
txTask.ReadLists = nil
|
returnWriteList(txTask.WriteLists)
|
||||||
}
|
txTask.WriteLists = nil
|
||||||
if txTask.WriteLists != nil {
|
|
||||||
returnWriteList(txTask.WriteLists)
|
|
||||||
txTask.WriteLists = nil
|
|
||||||
}
|
|
||||||
txTask.ResultsSize = 0
|
txTask.ResultsSize = 0
|
||||||
txTask.Logs = nil
|
txTask.Logs = nil
|
||||||
txTask.TraceFroms = nil
|
txTask.TraceFroms = nil
|
||||||
@ -862,13 +858,18 @@ var writeListPool = sync.Pool{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newWriteList() map[string]*exec22.KvList {
|
func newWriteList() map[string]*exec22.KvList {
|
||||||
w := writeListPool.Get().(map[string]*exec22.KvList)
|
v := writeListPool.Get().(map[string]*exec22.KvList)
|
||||||
for _, tbl := range w {
|
for _, tbl := range v {
|
||||||
tbl.Keys, tbl.Vals = tbl.Keys[:0], tbl.Vals[:0]
|
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{
|
var readListPool = sync.Pool{
|
||||||
New: func() any {
|
New: func() any {
|
||||||
@ -882,10 +883,15 @@ var readListPool = sync.Pool{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newReadList() map[string]*exec22.KvList {
|
func newReadList() map[string]*exec22.KvList {
|
||||||
w := readListPool.Get().(map[string]*exec22.KvList)
|
v := readListPool.Get().(map[string]*exec22.KvList)
|
||||||
for _, tbl := range w {
|
for _, tbl := range v {
|
||||||
tbl.Keys, tbl.Vals = tbl.Keys[:0], tbl.Vals[:0]
|
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