ssz
ssz copied to clipboard
feat: improve type.hashTreeRoot() using batch
Motivation
- improve type.hashTreeRoot() using batch
Description
- instead of
getRoots()
and compute root from there, this PR implementgetChunkBytes()
- this compute root using
merkleizeInto()
which use batch there - reuse
chunkBytesBuffer
memory in type, almost noUint8Array
allocations in the middle
- this compute root using
- new
hashTreeRootInto()
api. This is needed in case consumers want to reuse memory allocation there - use
allocUnsafe()
of as-sha256 where it makes sense
cherry picked from #378