MCPcopy Create free account
hub / github.com/pingcap/tidb / EncodeCompactBytes

Function EncodeCompactBytes

pkg/util/codec/bytes.go:164–168  ·  view source on GitHub ↗

EncodeCompactBytes joins bytes with its length into a byte slice. It is more efficient in both space and time compare to EncodeBytes. Note that the encoded result is not memcomparable.

(b []byte, data []byte)

Source from the content-addressed store, hash-verified

162// efficient in both space and time compare to EncodeBytes. Note that the encoded
163// result is not memcomparable.
164func EncodeCompactBytes(b []byte, data []byte) []byte {
165 b = reallocBytes(b, binary.MaxVarintLen64+len(data))
166 b = EncodeVarint(b, int64(len(data)))
167 return append(b, data...)
168}
169
170// DecodeCompactBytes decodes bytes which is encoded by EncodeCompactBytes before.
171func DecodeCompactBytes(b []byte) ([]byte, []byte, error) {

Callers 8

EncodeLockCFValueFunction · 0.92
evalAndEncodeFunction · 0.92
ReHashCodeFunction · 0.92
encodeOldDatumMethod · 0.92
encodeBytesFunction · 0.85
TestBytesFunction · 0.85

Calls 2

EncodeVarintFunction · 0.85
reallocBytesFunction · 0.70

Tested by 2

TestBytesFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…