Skip to content

Conversation

@iljakuklic
Copy link
Contributor

Change Map<T, Set<TxId>> to Set<(T, TxId)>. This representation makes it easier to maintain certain invariants, eliminating some bookkeeping, and generally simplifies code.

It is also slightly more efficient, reducing mempool memory requirements by about 5-10%.

Change `Map<T, Set<TxId>>` to `Set<(T, TxId)>`. This representation
makes it easier to maintain certain invariants, eliminating some
bookkeeping, and generally simplifies code.

It is also slightly more efficient, reducing mempool memory requirements
by about 5-10%.
type TrackedMap<K, V> = Tracked<BTreeMap<K, V>>;
type TrackedSet<K> = Tracked<BTreeSet<K>>;
type TrackedTxIdMultiMap<K> = TrackedMap<K, TrackedSet<Id<Transaction>>>;
type TrackedTxIdMultiMap<K> = TrackedSet<(K, Id<Transaction>)>;
Copy link
Contributor Author

@iljakuklic iljakuklic Aug 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the change. Everything else is to make the code work with this representation, usually simplifying the code in the process.

@iljakuklic iljakuklic merged commit 8f226c7 into master Aug 11, 2023
@iljakuklic iljakuklic deleted the mempool-multimap branch August 11, 2023 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mempool Mempool-related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants