mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
let set the whole children be faster
This commit is contained in:
parent
18a902799e
commit
b1ceb91c34
1 changed files with 3 additions and 3 deletions
|
|
@ -157,6 +157,8 @@ const (
|
||||||
hashedNode
|
hashedNode
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var emptyNodes = [16]*stNode{}
|
||||||
|
|
||||||
func (n *stNode) reset() *stNode {
|
func (n *stNode) reset() *stNode {
|
||||||
if n.typ == hashedNode {
|
if n.typ == hashedNode {
|
||||||
// On hashnodes, we 'own' the val: it is guaranteed to be not held
|
// On hashnodes, we 'own' the val: it is guaranteed to be not held
|
||||||
|
|
@ -166,9 +168,7 @@ func (n *stNode) reset() *stNode {
|
||||||
}
|
}
|
||||||
n.key = n.key[:0]
|
n.key = n.key[:0]
|
||||||
n.val = nil
|
n.val = nil
|
||||||
for i := range n.children {
|
copy(n.children[:], emptyNodes[:])
|
||||||
n.children[i] = nil
|
|
||||||
}
|
|
||||||
n.typ = emptyNode
|
n.typ = emptyNode
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue