Closed masih closed 3 years ago
We really shouldn't be special-casing "identity" CIDs at this layer. If we really need this for performance, we should have a function to get the multihash codec.
But I'm not convinced it matters. We're saving less than a nanosecond per op, which'll be nothing compared to all the other work we're going to end up doing.
Thank you @marten-seemann and @Stebalien for the reviews 🍻 I agree with @Stebalien.
Closing this as it does not add much value.
@marten-seemann @Stebalien I have extracted benchmarks from this PR into a new PR as a way to document the efficiency of existing APIs for IDENTITY
check. I think that's worth having 🙂
See: #135
Implement a fail-fast function that checks whether the code of a CID is
multihash.IDENTITY
or not.Add benchmarks that compare three ways of checking for
multihash.IDENTITY
code:Cid.Prefix().MhType
Cid.Has()
Cid.IsIdentity()
APIFixes #133