You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NodeJS represents Uint8Arrays inefficiently when they have small sizes. The validators object have pubkey and withdrawal_credentials that can be thought as an append-only list which take ~140MB in a single state.
Since validator objects are already represented as values internally inside a node the validator object could be a custom class instance with getters for pubkey and withdrawal_credentials that slice a Uint8Array of the shared one.
The text was updated successfully, but these errors were encountered:
dapplion
changed the title
Add ByteVectorShared
Add ByteVectorShared - optimize validator object memory
Jan 17, 2022
NodeJS represents Uint8Arrays inefficiently when they have small sizes. The validators object have pubkey and withdrawal_credentials that can be thought as an append-only list which take ~140MB in a single state.
An optimization to reduce their memory cost is to keep them in bigger Uint8Arrays that are shared for multiple pubkeys. This is possible as quickly tested in https://github.com/ChainSafe/ssz/tree/dapplion/byteVectorImmutable
Since validator objects are already represented as values internally inside a node the validator object could be a custom class instance with getters for pubkey and withdrawal_credentials that slice a Uint8Array of the shared one.
The text was updated successfully, but these errors were encountered: