cita-vm
cita-vm copied to clipboard
Should we cache storage trie for accounts?
See: https://github.com/cryptape/cita-vm/pull/31#discussion_r260114674
First of all, we already have 2 layer caches in use when call get_storage:
Call get_storage()
⬇
Account.storage_changes
⬇
K-V Cache on DB
⬇
Disk DB
From @yejiayu
When querying an uncached key, if you can reuse the previous path, you can reduce the consumption of many database IO and recovery node.
However, this will use more memory and the number of node that need to be calculated per commit will increase, because the hash node will be restored from the database.
So this optimization requires serious thinking.
Cache the whole storage_trie will speed up(maybe a bit) the performance, but the price is get more complexity in codes.