Skip to content

Commit a6751d6

Browse files
authored
core/rawdb,eth/protocols,p2p: prealloc slice size (#29893)
chore: prealloc slice size
1 parent 7270cba commit a6751d6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

eth/protocols/snap/sync.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3250,9 +3250,9 @@ func (t *healRequestSort) Merge() []TrieNodePathSet {
32503250
// sortByAccountPath takes hashes and paths, and sorts them. After that, it generates
32513251
// the TrieNodePaths and merges paths which belongs to the same account path.
32523252
func sortByAccountPath(paths []string, hashes []common.Hash) ([]string, []common.Hash, []trie.SyncPath, []TrieNodePathSet) {
3253-
var syncPaths []trie.SyncPath
3254-
for _, path := range paths {
3255-
syncPaths = append(syncPaths, trie.NewSyncPath([]byte(path)))
3253+
syncPaths := make([]trie.SyncPath, len(paths))
3254+
for i, path := range paths {
3255+
syncPaths[i] = trie.NewSyncPath([]byte(path))
32563256
}
32573257
n := &healRequestSort{paths, hashes, syncPaths}
32583258
sort.Sort(n)

0 commit comments

Comments
 (0)