mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 04:36:42 +00:00
eth/downloader: optimize fetch result concatenation
This commit is contained in:
parent
da3822dcec
commit
7d0be24267
1 changed files with 5 additions and 1 deletions
|
|
@ -940,7 +940,11 @@ func (d *Downloader) processSnapSyncContent() error {
|
|||
}
|
||||
}
|
||||
} else { // results already piled up, consume before handling pivot move
|
||||
results = append(append([]*fetchResult{oldPivot}, oldTail...), results...)
|
||||
newResults := make([]*fetchResult, 1+len(oldTail)+len(results))
|
||||
newResults[0] = oldPivot
|
||||
copy(newResults[1:], oldTail)
|
||||
copy(newResults[1+len(oldTail):], results)
|
||||
results = newResults
|
||||
}
|
||||
// Split around the pivot block and process the two sides via snap/full sync
|
||||
if !d.committed.Load() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue