Documentation
¶
Overview ¶
Package fastmsgpack offers a subset of msgpack serialization operated on fixed length []byte with no heap allocation, no IO abstraction and all calls are inlined.
Benchmark indicates at least 100% improvement in an independent worker (in/out are channels).
The calls should only be used for hot paths, e.g. serialization of individual log records, and NOT to be used in tests to verify anything.
Index ¶
- func EncodeArrayLen4(buffer []byte, start int, arrayLen int) int
- func EncodeArrayLen16(buffer []byte, start int, arrayLen int) int
- func EncodeArrayLen32(buffer []byte, start int, arrayLen int) int
- func EncodeExtHeader8(buffer []byte, start int, typeID byte) int
- func EncodeFloat64(buffer []byte, start int, value float64) int
- func EncodeInt32(buffer []byte, start int, value int32) int
- func EncodeMapLen4(buffer []byte, start int, mapLen int) int
- func EncodeMapLen16(buffer []byte, start int, mapLen int) int
- func EncodeMapLen32(buffer []byte, start int, mapLen int) int
- func EncodeString4(buffer []byte, start int, str string) int
- func EncodeString16(buffer []byte, start int, str string) int
- func EncodeString32(buffer []byte, start int, str string) int
- func EncodeStringLen4(buffer []byte, start int, strLen int) int
- func EncodeStringLen16(buffer []byte, start int, strLen int) int
- func EncodeStringLen32(buffer []byte, start int, strLen int) int
- func ReserveLen4(start int) int
- func ReserveLen16(start int) int
- func ReserveLen32(start int) int
- func Write2(buffer []byte, start int, n uint16) int
- func Write4(buffer []byte, start int, n uint32) int
- func Write8(buffer []byte, start int, n uint64) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeArrayLen4 ¶
EncodeArrayLen4 encodes the header of array up to 15 items
func EncodeArrayLen16 ¶
EncodeArrayLen16 encodes the header of array up to 65535 items
func EncodeArrayLen32 ¶
EncodeArrayLen32 encodes the header of array larger than 65535 items
func EncodeExtHeader8 ¶
EncodeExtHeader8 encodes an extension type of 8 bytes
func EncodeFloat64 ¶
EncodeFloat64 encodes a 64 bits floating number
func EncodeInt32 ¶
EncodeInt32 encodes a 32 bits uint
func EncodeMapLen4 ¶
EncodeMapLen4 encodes the header of map up to 15 items
func EncodeMapLen16 ¶
EncodeMapLen16 encodes the header of map up to 65535 items
func EncodeMapLen32 ¶
EncodeMapLen32 encodes the header of map larger than 65535 items
func EncodeString4 ¶
EncodeString4 encodes string up to 15 bytes
func EncodeString16 ¶
EncodeString16 encodes string up to 65535 bytes
func EncodeString32 ¶
EncodeString32 encodes string larger than 65535 bytes
func EncodeStringLen4 ¶
EncodeStringLen4 encodes the header of string up to 15 bytes
func EncodeStringLen16 ¶
EncodeStringLen16 encodes the header of string up to 65535 bytes
func EncodeStringLen32 ¶
EncodeStringLen32 encodes the header of string larger than 65535 bytes
func ReserveLen4 ¶
ReserveLen4 reserves space to encode length of some type up to 15 items
func ReserveLen16 ¶
ReserveLen16 reserves space to encode length of some type up to 65535 items
func ReserveLen32 ¶
ReserveLen32 reserves space to encode length of some type more than 65535 items
Types ¶
This section is empty.