forked from cerc-io/plugeth
core, eth: pre-allocate map in storage copy (#25279)
This commit is contained in:
parent
714fb302a5
commit
44893be0d6
@ -49,7 +49,7 @@ func (s Storage) String() (str string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s Storage) Copy() Storage {
|
func (s Storage) Copy() Storage {
|
||||||
cpy := make(Storage)
|
cpy := make(Storage, len(s))
|
||||||
for key, value := range s {
|
for key, value := range s {
|
||||||
cpy[key] = value
|
cpy[key] = value
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ type Storage map[common.Hash]common.Hash
|
|||||||
|
|
||||||
// Copy duplicates the current storage.
|
// Copy duplicates the current storage.
|
||||||
func (s Storage) Copy() Storage {
|
func (s Storage) Copy() Storage {
|
||||||
cpy := make(Storage)
|
cpy := make(Storage, len(s))
|
||||||
for key, value := range s {
|
for key, value := range s {
|
||||||
cpy[key] = value
|
cpy[key] = value
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user