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

feat: ListUintNum64Type create ViewDU from existing tree #402

Merged
merged 3 commits into from
Sep 13, 2024

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Sep 13, 2024

Motivation

  • In lodestar, at every epoch transition we create a new balances tree using ListUintNum64Type.toViewDU() api. This PR add an optional unusedViewDU to that api which helps reuse balances tree and avoid memory allocation in lodestar

Description

  • This PR is technically not related to batch hash work, however using executeHashComputation() is a great way to rehash the whole tree
  • The implementation is very similar to pushing new values to an existing ViewDU, then commit()
  • Unit test and perf test are added. Although perf test does not show a great improvement, memory would be saved a lot.

@twoeths twoeths marked this pull request as ready for review September 13, 2024 07:09
@twoeths twoeths requested a review from a team as a code owner September 13, 2024 07:09
@twoeths twoeths merged commit 91c735c into te/batch_hash_tree_root Sep 13, 2024
7 checks passed
@twoeths twoeths deleted the te/list_uint64_to_viewDU branch September 13, 2024 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant