[draft] Remove the dirty linked list in CCoinsViewCache#13
Draft
optout21 wants to merge 1 commit into
Draft
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
WIP
CCoinsViewCacheholds a map of all cache entries, and a separate, own-implementation doubly-linked-list for the subset of dirty (and fresh) entries. Experiment with removing this linked list, in order to reduce the memory usage of the cache.The memory reduction is 2 pointers per cache entry, or 16 bytes (on 64-bit systems), which is roughly a 10.5% reduction in memory (assuming 137 byte avg. size for a cache entry).
Note that the size of these pointers is not considered in the memory measurement of the map (but it still takes up memory).
The linked list is replaced by iterating over all entries, and checking if they are dirty (or fresh, flagged).
Performance aspect is to be evaluated.
Performance depends on the ratio of flagged to total entries. Assuming a long period until the cache is flushed, the number of freshly added outputs and spent outputs should be rather high.