diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-06-21 17:28:05 +0800 |
---|---|---|
committer | Felix Lange <fjl@users.noreply.github.com> | 2018-06-21 17:28:05 +0800 |
commit | d926bf2c7e3182d694c15829a37a0ca7331cd03c (patch) | |
tree | c2d3ddd85941a231fb05de46c36703273d11814a /eth/api_tracer.go | |
parent | 8db8d074e2fff547e9d85169018e03f89b5975a1 (diff) | |
download | go-tangerine-d926bf2c7e3182d694c15829a37a0ca7331cd03c.tar go-tangerine-d926bf2c7e3182d694c15829a37a0ca7331cd03c.tar.gz go-tangerine-d926bf2c7e3182d694c15829a37a0ca7331cd03c.tar.bz2 go-tangerine-d926bf2c7e3182d694c15829a37a0ca7331cd03c.tar.lz go-tangerine-d926bf2c7e3182d694c15829a37a0ca7331cd03c.tar.xz go-tangerine-d926bf2c7e3182d694c15829a37a0ca7331cd03c.tar.zst go-tangerine-d926bf2c7e3182d694c15829a37a0ca7331cd03c.zip |
trie: cache collapsed tries node, not rlp blobs (#16876)
The current trie memory database/cache that we do pruning on stores
trie nodes as binary rlp encoded blobs, and also stores the node
relationships/references for GC purposes. However, most of the trie
nodes (everything apart from a value node) is in essence just a
collection of references.
This PR switches out the RLP encoded trie blobs with the
collapsed-but-not-serialized trie nodes. This permits most of the
references to be recovered from within the node data structure,
avoiding the need to track them a second time (expensive memory wise).
Diffstat (limited to 'eth/api_tracer.go')
-rw-r--r-- | eth/api_tracer.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/eth/api_tracer.go b/eth/api_tracer.go index 61f5c71d6..623e5ed1b 100644 --- a/eth/api_tracer.go +++ b/eth/api_tracer.go @@ -297,7 +297,7 @@ func (api *PrivateDebugAPI) traceChain(ctx context.Context, start, end *types.Bl database.TrieDB().Reference(root, common.Hash{}) } // Dereference all past tries we ourselves are done working with - database.TrieDB().Dereference(proot, common.Hash{}) + database.TrieDB().Dereference(proot) proot = root // TODO(karalabe): Do we need the preimages? Won't they accumulate too much? @@ -320,7 +320,7 @@ func (api *PrivateDebugAPI) traceChain(ctx context.Context, start, end *types.Bl done[uint64(result.Block)] = result // Dereference any paret tries held in memory by this task - database.TrieDB().Dereference(res.rootref, common.Hash{}) + database.TrieDB().Dereference(res.rootref) // Stream completed traces to the user, aborting on the first error for result, ok := done[next]; ok; result, ok = done[next] { @@ -526,7 +526,7 @@ func (api *PrivateDebugAPI) computeStateDB(block *types.Block, reexec uint64) (* return nil, err } database.TrieDB().Reference(root, common.Hash{}) - database.TrieDB().Dereference(proot, common.Hash{}) + database.TrieDB().Dereference(proot) proot = root } nodes, imgs := database.TrieDB().Size() |