A custom storage engine of Nethermind, benefiting from the alignment of the underlying data structure with the layout of State & Storage trees of Ethereum.
This PR changes the Prefetcher component to fix a bug. It also addresses a few issues in the construction and usage of the prefetcher in regards to the ComputeMerkleBehavior. It makes the following changes:
Prefetcher always owns the cache / preCommit explicitly with a lock. The lock will not be contended as there will be only one IThreadPoolWorkItem executing at any time. This allows for a simple ownership of this dictionary that should be owned either by Prefetcher (when possible and spinning to prefetch things) or ComputeMerkleBehavior when performing the computation.
RlpMemo.Decompress is from now on called on by Prefetcher whenever the Branch is not loaded into the current block yet. Previously, compressed RlpMemo was stored, which resulted in MarkPathAsDirty and other calls sites, decompressing RlpMemo in the hot path. Now, with the data decompressed. It should just use data.
ChildCommit now delegates the ownership to its parent, similar to what #420 did for Prefixing. This should limit the number of copies further, directly writing to the parent commit as the data are fetched already by Prefetcher
This PR changes the
Prefetcher
component to fix a bug. It also addresses a few issues in the construction and usage of the prefetcher in regards to theComputeMerkleBehavior
. It makes the following changes:Prefetcher
always owns thecache
/preCommit
explicitly with a lock. The lock will not be contended as there will be only oneIThreadPoolWorkItem
executing at any time. This allows for a simple ownership of this dictionary that should be owned either byPrefetcher
(when possible and spinning to prefetch things) orComputeMerkleBehavior
when performing the computation.RlpMemo.Decompress
is from now on called on byPrefetcher
whenever theBranch
is not loaded into the current block yet. Previously, compressedRlpMemo
was stored, which resulted inMarkPathAsDirty
and other calls sites, decompressingRlpMemo
in the hot path. Now, with the data decompressed. It should just use data.ChildCommit
now delegates the ownership to its parent, similar to what #420 did forPrefixing
. This should limit the number of copies further, directly writing to the parent commit as the data are fetched already byPrefetcher