-
-
Notifications
You must be signed in to change notification settings - Fork 17
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: implement HashComputationLevel using LinkedList #389
base: master
Are you sure you want to change the base?
Conversation
Performance Report✔️ no performance regression detected 🚀🚀 Significant benchmark improvement detected
Full benchmark results
|
this is where it optimizes memory? |
newTail.dest = dest; | ||
} else { | ||
// grow the list | ||
newTail = {src0, src1, dest, next: null}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this part optimizes memory over the array implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, when we are at length 1M, for example, pushing a new item cause very small allocation for LinkedList while could be a big deal for an array, especially array of objects
that's why we see a lot of 1s spikes using Array
Motivation
HashComputationGroup
andHashComputationLevel
to be able to reuse at the consumer side where it makes sense (for example: processBlocks, compute root for BeaconState.balances)Description
HashComputation
type and its utils to a separate classHashComputationLevel
to be a linked-list like to save memory allocation:hashtree
: allocatedestNodes
variable once, set it as defaultsubtreeFillToContents
+setNodesAtDepth
: destructure params in order not to allocate temporary objects at the consumer sidetest result was persisted here
part of #378
cc @wemeetagain @g11tech