Skip to content

Commit

Permalink
core, eth: pre-allocate map in storage copy (ethereum#25279)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbadoy authored and HanWang233 committed Sep 11, 2022
1 parent 1b0fd10 commit 18869d8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/state/state_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (s Storage) String() (str string) {
}

func (s Storage) Copy() Storage {
cpy := make(Storage)
cpy := make(Storage, len(s))
for key, value := range s {
cpy[key] = value
}
Expand Down
2 changes: 1 addition & 1 deletion eth/tracers/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type Storage map[common.Hash]common.Hash

// Copy duplicates the current storage.
func (s Storage) Copy() Storage {
cpy := make(Storage)
cpy := make(Storage, len(s))
for key, value := range s {
cpy[key] = value
}
Expand Down

0 comments on commit 18869d8

Please sign in to comment.