Closed jannikluhn closed 4 years ago
I made a version of the existing tree hash benchmark that uses the new hashable datastructures to compute the same update. It's very hacky, but it works and the result looks good (first is the existing one, second is the updated one, both with 100k validators):
state.hash_tree_root 0b30f108266c59b2f5ab82d47408667b9cff6e7099cb5a2a6e17001ed4f971c6
state.hash_tree_root 0b30f108266c59b2f5ab82d47408667b9cff6e7099cb5a2a6e17001ed4f971c6
----- start -----
updated fd6a564710f96c042762a7af3819f042447c818c257b1ce8f3a878070db85980
----- end -----
state: 7.4242s
----- start -----
updated fd6a564710f96c042762a7af3819f042447c818c257b1ce8f3a878070db85980
----- end -----
state_hashable: 0.0078s
Note that the timing does not include the original setup (i.e. calculation of the hash tree in the beginning), just the update. But that's the whole idea, most of the time we update only a small part of the tree.
@jannikluhn
(I think) since we are caching hash_eth2
function results, you have to make sure that the second benchmark is running on a clean environment. I got state_hashable: 0.0050s
when I first-time run python scripts/benchmark/tree_hash.py
, and got 0.0128s
after I commented out the old Serializable benchmark -- still good though! 🎉
Implements HashableList, HashableVector, and HashableContainer, along with some other changes (mostly moving code around and renaming).
HashableVector
andHashableList
are relatively close to what they'll look like in the end, butHashableContainer
is just meant for testing and benchmarking for now (most importantly, it doesn't allow element access with.
notation yet).Cute Animal Picture