child trie optimization
A few optimization that may require changing 'trie' crates.
-
default_child_trie_rootfunction is mainly use to check if a trie gets empty.
This value is calculated every time but always returns the same value.
Function defauld_chid_trie_root should be able to return a constant value.
I should be a constant (ideally calculated at compilation like proposed in paritytech/polkadot-sdk#372 from a empty trie encoded value).
This issue may also involve changing some components in https://github.com/paritytech/trie.
- related to paritytech/substrate#2209 KeySpacedDB
KeySpacedDB currently prepened keyspace to the prefix and then memorydb keyfunction prepend the prefix to the key.
There is a new vec in each steps, reasonably a single instantiation should be done.
An approach could be to change key function, triedb and triedbmut to be aware of keyspace like in https://github.com/paritytech/trie/compare/master...cheme:kf_change (code from paritytech/substrate#2209 also get way simplier).