trie/pathdb: preallocate map capacity (#29690)

* preallocated capacity for map's certain usege of memory

* preallocated capacity for map's certain usege of memory
pull/29696/head
maskpp 6 months ago committed by GitHub
parent fbf6238ae9
commit 2c67fab0d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      triedb/pathdb/nodebuffer.go

@ -90,7 +90,7 @@ func (b *nodebuffer) commit(nodes map[common.Hash]map[string]*trienode.Node) *no
// The nodes belong to original diff layer are still accessible even // The nodes belong to original diff layer are still accessible even
// after merging, thus the ownership of nodes map should still belong // after merging, thus the ownership of nodes map should still belong
// to original layer and any mutation on it should be prevented. // to original layer and any mutation on it should be prevented.
current = make(map[string]*trienode.Node) current = make(map[string]*trienode.Node, len(subset))
for path, n := range subset { for path, n := range subset {
current[path] = n current[path] = n
delta += int64(len(n.Blob) + len(path)) delta += int64(len(n.Blob) + len(path))

Loading…
Cancel
Save