celestiaorg / nmt

Namespaced Merkle Tree
Apache License 2.0
107 stars 39 forks source link

extract `computeRoot` to a separate method #261

Open rach-id opened 1 month ago

rach-id commented 1 month ago
          I think this was simpler because `computeRoot` also operates on a few vars inside of the scope of the wrapping method (e.g. `subtreeRoots`). I think this was an optimization wrt to the recursive calls. I would merge as is but if benchmarks and readability improve or stay the same, I would not mind Evan's suggestion in a followup PR.

_Originally posted by @liamsi in https://github.com/celestiaorg/nmt/pull/260#discussion_r1648010073_

rach-id commented 1 month ago

Also this: https://github.com/celestiaorg/nmt/pull/260#discussion_r1648748046