ssz icon indicating copy to clipboard operation
ssz copied to clipboard

feat: improve type.hashTreeRoot() using batch

Open twoeths opened this issue 4 months ago • 3 comments

Motivation

  • improve type.hashTreeRoot() using batch

Description

  • instead of getRoots() and compute root from there, this PR implement getChunkBytes()
    • this compute root using merkleizeInto() which use batch there
    • reuse chunkBytesBuffer memory in type, almost no Uint8Array allocations in the middle
  • 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

twoeths avatar Oct 15 '24 03:10 twoeths