diff --git a/_rsrch/cidiface/cid.go b/_rsrch/cidiface/cid.go index cb4b871..3ef3001 100644 --- a/_rsrch/cidiface/cid.go +++ b/_rsrch/cidiface/cid.go @@ -39,7 +39,8 @@ type Cid interface { // and the Multihash length. It does not contains // any actual content information. // NOTE: The use -1 in MhLength to mean default length is deprecated, -// use the V0Builder or V1Builder structures instead +// +// use the V0Builder or V1Builder structures instead type Prefix struct { Version uint64 Codec uint64 diff --git a/_rsrch/cidiface/cidBoxingBench_test.go b/_rsrch/cidiface/cidBoxingBench_test.go index 920ce1f..8c908b8 100644 --- a/_rsrch/cidiface/cidBoxingBench_test.go +++ b/_rsrch/cidiface/cidBoxingBench_test.go @@ -12,14 +12,14 @@ import ( // // Sample results on linux amd64 go1.11beta: // -// BenchmarkCidMap_CidStr-8 100000 16317 ns/op -// BenchmarkCidMap_CidIface-8 100000 20516 ns/op +// BenchmarkCidMap_CidStr-8 100000 16317 ns/op +// BenchmarkCidMap_CidIface-8 100000 20516 ns/op // // With benchmem on: // -// BenchmarkCidMap_CidStr-8 100000 15579 ns/op 11223 B/op 207 allocs/op -// BenchmarkCidMap_CidIface-8 100000 19500 ns/op 12824 B/op 307 allocs/op -// BenchmarkCidMap_StrPlusHax-8 200000 10451 ns/op 7589 B/op 202 allocs/op +// BenchmarkCidMap_CidStr-8 100000 15579 ns/op 11223 B/op 207 allocs/op +// BenchmarkCidMap_CidIface-8 100000 19500 ns/op 12824 B/op 307 allocs/op +// BenchmarkCidMap_StrPlusHax-8 200000 10451 ns/op 7589 B/op 202 allocs/op // // We can see here that the impact of interface boxing is significant: // it increases the time taken to do the inserts to 133%, largely because @@ -36,7 +36,6 @@ import ( // re-arranges itself, it involves more or less an O(n) copy of the content // in addition to the alloc itself). This isn't topical to the question of // whether or not interfaces are a good idea; just for contextualizing. -// func BenchmarkCidMap_CidStr(b *testing.B) { for i := 0; i < b.N; i++ { mp := map[CidStr]int{} diff --git a/_rsrch/cidiface/cidString.go b/_rsrch/cidiface/cidString.go index 129fafd..76e63a1 100644 --- a/_rsrch/cidiface/cidString.go +++ b/_rsrch/cidiface/cidString.go @@ -114,7 +114,7 @@ func NewCidStr(version uint64, codecType uint64, mhash mh.Multihash) CidStr { // // For CidV1, the data buffer is in the form: // -// +// // // CidV0 are also supported. In particular, data buffers starting // with length 34 bytes, which starts with bytes [18,32...] are considered diff --git a/_rsrch/cidiface/cidStruct.go b/_rsrch/cidiface/cidStruct.go index 2fd5fa7..8ffec9f 100644 --- a/_rsrch/cidiface/cidStruct.go +++ b/_rsrch/cidiface/cidStruct.go @@ -110,7 +110,7 @@ func (c CidStruct) Prefix() Prefix { // // For CidV1, the data buffer is in the form: // -// +// // // CidV0 are also supported. In particular, data buffers starting // with length 34 bytes, which starts with bytes [18,32...] are considered diff --git a/cid.go b/cid.go index bccc882..651c94d 100644 --- a/cid.go +++ b/cid.go @@ -10,7 +10,7 @@ // // A CIDv1 has four parts: // -// ::= +// ::= // // As shown above, the CID implementation relies heavily on Multiformats, // particularly Multibase @@ -193,7 +193,7 @@ func MustParse(v interface{}) Cid { // Decode parses a Cid-encoded string and returns a Cid object. // For CidV1, a Cid-encoded string is primarily a multibase string: // -// +// // // The base-encoded string represents a: // @@ -249,7 +249,7 @@ func ExtractEncoding(v string) (mbase.Encoding, error) { // Cast takes a Cid data slice, parses it and returns a Cid. // For CidV1, the data buffer is in the form: // -// +// // // CidV0 are also supported. In particular, data buffers starting // with length 34 bytes, which starts with bytes [18,32...] are considered @@ -465,7 +465,7 @@ func (c *Cid) UnmarshalJSON(b []byte) error { // MarshalJSON procudes a JSON representation of a Cid, which looks as follows: // -// { "/": "" } +// { "/": "" } // // Note that this formatting comes from the IPLD specification // (https://github.com/ipld/specs/tree/master/ipld) @@ -522,7 +522,8 @@ func (c Cid) Prefix() Prefix { // and the Multihash length. It does not contains // any actual content information. // NOTE: The use -1 in MhLength to mean default length is deprecated, -// use the V0Builder or V1Builder structures instead +// +// use the V0Builder or V1Builder structures instead type Prefix struct { Version uint64 Codec uint64 @@ -561,7 +562,7 @@ func (p Prefix) Sum(data []byte) (Cid, error) { // Bytes returns a byte representation of a Prefix. It looks like: // -// +// func (p Prefix) Bytes() []byte { size := varint.UvarintSize(p.Version) size += varint.UvarintSize(p.Codec)