ipfs / go-cid

Content ID v1 implemented in go
MIT License
157 stars 47 forks source link

perf: add a generic CID type which allows for aliased byte slices #159

Closed Jorropo closed 9 months ago

Jorropo commented 1 year ago

This is backward compatible (that why I hacked it with generics). I should probably make generic versions of the builders too.

Results:

name   old time/op    new time/op    delta
PB-12     730ns ± 5%     255ns ± 2%   -65.04%  (p=0.000 n=9+10)

name   old alloc/op   new alloc/op   delta
PB-12      224B ± 0%        0B       -100.00%  (p=0.000 n=10+10)

name   old allocs/op  new allocs/op  delta
PB-12      4.00 ± 0%      0.00       -100.00%  (p=0.000 n=10+10)