fastmsgpack

package
v0.0.0-...-b41040d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2025 License: MIT Imports: 2 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeArrayLen4

func EncodeArrayLen4(buffer []byte, start int, arrayLen int) int

EncodeArrayLen4 encodes the header of array up to 15 items

func EncodeArrayLen16

func EncodeArrayLen16(buffer []byte, start int, arrayLen int) int

EncodeArrayLen16 encodes the header of array up to 65535 items

func EncodeArrayLen32

func EncodeArrayLen32(buffer []byte, start int, arrayLen int) int

EncodeArrayLen32 encodes the header of array larger than 65535 items

func EncodeExtHeader8

func EncodeExtHeader8(buffer []byte, start int, typeID byte) int

EncodeExtHeader8 encodes an extension type of 8 bytes

func EncodeFloat64

func EncodeFloat64(buffer []byte, start int, value float64) int

EncodeFloat64 encodes a 64 bits floating number

func EncodeInt32

func EncodeInt32(buffer []byte, start int, value int32) int

EncodeInt32 encodes a 32 bits uint

func EncodeMapLen4

func EncodeMapLen4(buffer []byte, start int, mapLen int) int

EncodeMapLen4 encodes the header of map up to 15 items

func EncodeMapLen16

func EncodeMapLen16(buffer []byte, start int, mapLen int) int

EncodeMapLen16 encodes the header of map up to 65535 items

func EncodeMapLen32

func EncodeMapLen32(buffer []byte, start int, mapLen int) int

EncodeMapLen32 encodes the header of map larger than 65535 items

func EncodeString4

func EncodeString4(buffer []byte, start int, str string) int

EncodeString4 encodes string up to 15 bytes

func EncodeString16

func EncodeString16(buffer []byte, start int, str string) int

EncodeString16 encodes string up to 65535 bytes

func EncodeString32

func EncodeString32(buffer []byte, start int, str string) int

EncodeString32 encodes string larger than 65535 bytes

func EncodeStringLen4

func EncodeStringLen4(buffer []byte, start int, strLen int) int

EncodeStringLen4 encodes the header of string up to 15 bytes

func EncodeStringLen16

func EncodeStringLen16(buffer []byte, start int, strLen int) int

EncodeStringLen16 encodes the header of string up to 65535 bytes

func EncodeStringLen32

func EncodeStringLen32(buffer []byte, start int, strLen int) int

EncodeStringLen32 encodes the header of string larger than 65535 bytes

func ReserveLen4

func ReserveLen4(start int) int

ReserveLen4 reserves space to encode length of some type up to 15 items

func ReserveLen16

func ReserveLen16(start int) int

ReserveLen16 reserves space to encode length of some type up to 65535 items

func ReserveLen32

func ReserveLen32(start int) int

ReserveLen32 reserves space to encode length of some type more than 65535 items

func Write2

func Write2(buffer []byte, start int, n uint16) int

Write2 encodes big-endian uint of 2 bytes

func Write4

func Write4(buffer []byte, start int, n uint32) int

Write4 encodes big-endian uint of 4 bytes

func Write8

func Write8(buffer []byte, start int, n uint64) int

Write8 encodes big-endian uint of 8 bytes

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL