Uh oh!
There was an error while loading. Please reload this page.
Changes tries build cache - #2933
Conversation
added CT build cache test
a90ecd7 to
e9e1f4aCompare
cheme
left a comment
There was a problem hiding this comment.
Cache logic looks good.
I could not really assert what happen on fork (doc says it get reinit on first next CT insert, but I could not really find it).
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
* changes tries build cache added CT build cache test * fix lines width * fixed some grumbles * clear cache when: digests disabled, top-level or skewed digest is built * cached_changed_keys -> with_cached_changed_keys
* changes tries build cache added CT build cache test * fix lines width * fixed some grumbles * clear cache when: digests disabled, top-level or skewed digest is built * cached_changed_keys -> with_cached_changed_keys
Problem: when digest tries are built, we need to read some previous changes tries.
Example: in 4^2 configuration, when block#16 is built, we need to read tries of blocks: 4, 8, 12, 13, 14, 15.
Proposed optimization: maintain in-memory
HashMap<Block => Set<ChangedKeys>>&& use it instead of reading tries directly from the database.Some details:
The cache itself isn't very useful when there's a plenty of memory dedicated to database cache + when top-level digests aren't covering large blocks ranges. E.g. block#512 in 512^1 configuration, that is normally imported in 0.3511s, with this optimization is imported in 0.2932s. Block#1024 in 1024^1 configuration, that is normally imported in 0.6961s, with this optimization is imported in 0.6047s. The difference isn't that big, but if we'll consider situation when there's lack of memory dedicated to database cache (i.e. when tries nodes are actually read from DB, not the rocks-db cache), then the situation seems much better with this optimization: 0.9514s -> 0.6167s.