Skip to content

Basekick-Labs/msgpack

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

588 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MessagePack encoding for Golang

Build Status PkgGoDev Discord

A performance-optimized fork of vmihailenco/msgpack/v5, maintained by Basekick Labs. Built for Arc, a high-performance time-series database. The upstream module path is preserved for drop-in compatibility.

What's New in v6

Decode — ~21% faster, ~50% less memory:

  • Zero-allocation byte-slice reader for Unmarshal()
  • *interface{} fast path bypasses reflect for the most common decode pattern

Encode — ~12% faster, ~43% fewer allocations:

  • Pooled byte buffer in Marshal() eliminates per-call bytes.Buffer
  • Native WriteByte on the Marshal path removes per-byte heap allocations
  • Type-switch fast paths for map[string]interface{} and []interface{}

Security:

  • OOM protection: slice and map allocations from untrusted input are capped at 1M elements

See CHANGELOG.md for full details.

Resources

Features

Installation

msgpack supports 2 last Go versions and requires support for Go modules. So make sure to initialize a Go module:

go mod init github.com/my/repo

And then install msgpack (the module path is unchanged from upstream for drop-in compatibility):

go get github.com/vmihailenco/msgpack/v5

Quickstart

import "github.com/vmihailenco/msgpack/v5"

func ExampleMarshal() {
    type Item struct {
        Foo string
    }

    b, err := msgpack.Marshal(&Item{Foo: "bar"})
    if err != nil {
        panic(err)
    }

    var item Item
    err = msgpack.Unmarshal(b, &item)
    if err != nil {
        panic(err)
    }
    fmt.Println(item.Foo)
    // Output: bar
}

Contributors

Thanks to all the people who already contributed!

About

msgpack.org[Go] MessagePack encoding for Golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Go 99.9%
  • Other 0.1%