Skip to content

perf(trie): use Arc<BranchNodeCompact> to reduce memory cloning in TrieUpdates#84

Draft
defistar wants to merge 1 commit intodevfrom
feature/extend_ref_optimisation
Draft

perf(trie): use Arc<BranchNodeCompact> to reduce memory cloning in TrieUpdates#84
defistar wants to merge 1 commit intodevfrom
feature/extend_ref_optimisation

Conversation

@defistar
Copy link

use Arc to reduce memory cloning in TrieUpdates

Replace owned BranchNodeCompact with Arc-wrapped nodes across trie data structures. This optimization significantly reduces memory allocations during block aggregation in RPC caches by sharing nodes instead of deep cloning ~112-byte structures.

Impact: ~3x faster extend_ref() calls (440µs vs 1,357µs for 1024 blocks) and 14x memory reduction per node (8 bytes Arc pointer vs 112 bytes full clone).

…ieUpdates

Replace owned BranchNodeCompact with Arc-wrapped nodes across trie data structures.
This optimization significantly reduces memory allocations during block aggregation
in RPC caches by sharing nodes instead of deep cloning ~112-byte structures.

Impact: ~3x faster extend_ref() calls (440µs vs 1,357µs for 1024 blocks) and 14x
memory reduction per node (8 bytes Arc pointer vs 112 bytes full clone).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant