go-hamt-ipld icon indicating copy to clipboard operation
go-hamt-ipld copied to clipboard

use generic pointers

Open Stebalien opened this issue 1 year ago • 1 comments

~It sucks, but, as far as I know, this is the only way to avoid reflection and other pointy nastiness.~

After applying @Wondertan, it's less terrible.

Stebalien avatar Aug 02 '24 19:08 Stebalien

See https://medium.com/@reetas/using-generics-with-pointer-receivers-in-go-39ee237d7475

Stebalien avatar Aug 02 '24 19:08 Stebalien

I've pulled this in to rvagg/generics and made some additional modifications, including creating and holding the zero value on the Node and its children instead of making a new one every time we pass through modifyValue(). (Although, I can't say I measured a huge perf difference when doing this in https://github.com/filecoin-project/go-state-types/pull/298).

rvagg avatar Aug 05 '24 02:08 rvagg