This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
added CT build cache test
svyatonik
force-pushed
the
changes_trie_build_cache2
branch
from
July 23, 2019 09:48
a90ecd7
to
e9e1f4a
Compare
svyatonik
added
A0-please_review
Pull request needs code review.
and removed
A1-onice
labels
Jul 23, 2019
svyatonik
added
A0-please_review
Pull request needs code review.
and removed
A3-needsresolving
labels
Aug 8, 2019
svyatonik
added
A3-needsresolving
and removed
A0-please_review
Pull request needs code review.
labels
Sep 2, 2019
svyatonik
added
A0-please_review
Pull request needs code review.
and removed
A3-needsresolving
labels
Sep 2, 2019
cheme
reviewed
Sep 3, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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).
cheme
approved these changes
Sep 4, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
andresilva
pushed a commit
that referenced
this pull request
Sep 17, 2019
* 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
Demi-Marie
pushed a commit
to Demi-Marie/substrate
that referenced
this pull request
Sep 17, 2019
* 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.