ipld / specs

Content-addressed, authenticated, immutable data structures
Other
592 stars 108 forks source link

suggest cheaper HAMT bitWidth arithmetic #309

Closed mvdan closed 3 years ago

mvdan commented 3 years ago

Since bitWidth and the map length work with power of twos, we can use shifts and trailing zero bit counts in lower-level languages like Go. Those are much, much simpler and faster than float-based math.Pow and math.Log2.

This was implemented in go-ipld-adl-hamt, and Rod suggested we include this hint in the spec.