Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimise overwriting existing HashList / HashArray when loading SSZ #49

Open
arnetheduck opened this issue May 15, 2023 · 0 comments
Open

Comments

@arnetheduck
Copy link
Member

HashList/HashArray cache the hash of the underlying data - for reasons of simplicity, when we load SSZ into an existing instance (via var overloads), we wipe both data and caches then load the data into a fresh instance.

However, for certain lists - validator sets in ethereum in particular - the majority of such loads do not change the data at all or change it only a little (ie add a few entries or modify a small subset of entries).

It would thus make sense to detect when this happens and not clear the cache, instead letting it be - however, this does not make sense for all lists or for known-large-changes so some heuristics need to be in place.

The overhead of comparing data vs simply overwriting + hashing should probably be studied - re-hashing the validator set on ethereum however is known to take up a significant amount of time.

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

No branches or pull requests

1 participant