mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-03-02 09:33:46 +00:00
core/state: preallocate capacity for logs list (#32291)
Improvement: preallocate capacity for `logs` at first to avoid reallocating multi times.
This commit is contained in:
parent
eb7aef45a7
commit
a56558d092
1 changed files with 1 additions and 1 deletions
|
|
@ -258,7 +258,7 @@ func (s *StateDB) GetLogs(hash common.Hash, blockNumber uint64, blockHash common
|
|||
}
|
||||
|
||||
func (s *StateDB) Logs() []*types.Log {
|
||||
var logs []*types.Log
|
||||
logs := make([]*types.Log, 0, s.logSize)
|
||||
for _, lgs := range s.logs {
|
||||
logs = append(logs, lgs...)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue