citahub / cita_trie

Rust implementation of the Modified Patricia Tree (aka Trie).
Apache License 2.0
71 stars 28 forks source link

rewrite: Use "rc" and "refcell" to avoid all clones. #43

Closed yejiayu closed 5 years ago

yejiayu commented 5 years ago

Changes

  1. Wrap the node with rc and refcell to avoid cloning the entire tree when modifying it.
  2. Serialize internally using rlp. Removed the custom codec trait (because I don't think it is necessary).
  3. Added the hasher trait of the custom hash algorithm and provided the implementation of keccak256.
  4. Removed generics from TrieError

benchmark

before: image after: image

yejiayu commented 5 years ago

fix #42

mohanson commented 5 years ago

Tested in cita-vm, this pr is great!

boundless-forest commented 5 years ago

Such amazing performance improvement !! :+1: