Skip to content

Commit

Permalink
trie/pathdb: preallocate map capacity (#29690)
Browse files Browse the repository at this point in the history
* preallocated capacity for map's certain usege of memory

* preallocated capacity for map's certain usege of memory
  • Loading branch information
mask-pp authored May 2, 2024
1 parent fbf6238 commit 2c67fab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion triedb/pathdb/nodebuffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
// after merging, thus the ownership of nodes map should still belong
// 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 {
current[path] = n
delta += int64(len(n.Blob) + len(path))
Expand Down

0 comments on commit 2c67fab

Please sign in to comment.