Skip to content

Basekick-Labs/msgpack

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

634 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.

What's New in v6

15 performance optimizations — +8.6% throughput in Arc production benchmarks:

  • Zero-allocation byte-slice reader for Unmarshal() (~21% faster, ~50% less memory)
  • *interface{} fast path bypasses reflect for the most common decode pattern
  • Pooled byte buffer and MarshalAppend API for zero-alloc encode
  • Type-switch fast paths for map[string]interface{}, map[string]string, []interface{}
  • Two-pass OmitEmpty, isZeroer caching, reflect.Convert skip, sorted key pooling
  • sync.Pool replacement for goroutine-per-type value cache

15 bug fixes — including OOM protection, float-to-int decoding, non-addressable pointer encode, and more.

See CHANGELOG.md for full details and the v6.0.0 release.

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:

go get github.com/Basekick-Labs/msgpack/v6

Quickstart

import "github.com/Basekick-Labs/msgpack/v6"

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

Packages

 
 
 

Contributors

Languages

  • Go 99.9%
  • Other 0.1%