mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
decrease the creation of hasher
This commit is contained in:
parent
c8be0f9a74
commit
1df4eb14d6
1 changed files with 10 additions and 10 deletions
|
|
@ -105,18 +105,18 @@ func (h *hasher) hashFullNodeChildren(n *fullNode) *fullNode {
|
|||
var children [17]node
|
||||
if h.parallel {
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(16)
|
||||
for i := 0; i < 16; i++ {
|
||||
if child := n.Children[i]; child != nil {
|
||||
wg.Add(1)
|
||||
go func(i int) {
|
||||
hasher := newHasher(false)
|
||||
if child := n.Children[i]; child != nil {
|
||||
children[i] = hasher.hash(child, false)
|
||||
} else {
|
||||
children[i] = nilValueNode
|
||||
}
|
||||
returnHasherToPool(hasher)
|
||||
wg.Done()
|
||||
}(i)
|
||||
} else {
|
||||
children[i] = nilValueNode
|
||||
}
|
||||
}
|
||||
wg.Wait()
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue