All Projects → alexflint → Go Memdump

alexflint / Go Memdump

Licence: bsd-2-clause
Very fast, very unsafe serialization for Go

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Go Memdump

Go
A high-performance 100% compatible drop-in replacement of "encoding/json"
Stars: ✭ 10,248 (+8584.75%)
Mutual labels:  serialization
Hprose Delphi
Hprose is a cross-language RPC. This project is Hprose 2.0 for Delphi and FreePascal
Stars: ✭ 100 (-15.25%)
Mutual labels:  serialization
Pretty Yaml
PyYAML-based module to produce pretty and readable YAML-serialized data
Stars: ✭ 110 (-6.78%)
Mutual labels:  serialization
Edn format
EDN reader and writer implementation in Python, using PLY (lex, yacc)
Stars: ✭ 92 (-22.03%)
Mutual labels:  serialization
Succ
Sexy and Utilitarian Code Configuration
Stars: ✭ 100 (-15.25%)
Mutual labels:  serialization
Loopback Component Jsonapi
JSONAPI support for loopback.
Stars: ✭ 104 (-11.86%)
Mutual labels:  serialization
Msgpack Scala
MessagePack serializer implementation for Scala / msgpack.org[Scala]
Stars: ✭ 87 (-26.27%)
Mutual labels:  serialization
Ron
Rusty Object Notation
Stars: ✭ 1,834 (+1454.24%)
Mutual labels:  serialization
Store
Fast binary serialization in Haskell
Stars: ✭ 100 (-15.25%)
Mutual labels:  serialization
Faraday
Serialization library built for speed and memory efficiency
Stars: ✭ 110 (-6.78%)
Mutual labels:  serialization
Nestedtypes
BackboneJS compatibility layer for Type-R data framework.
Stars: ✭ 94 (-20.34%)
Mutual labels:  serialization
Msgpack
msgpack.org[Go] MessagePack encoding for Golang
Stars: ✭ 1,353 (+1046.61%)
Mutual labels:  serialization
Undopro
UndoPro is a command-based undo system integrated into Unity's default system. This allows devs to use actions for their undo/redo operations without forcing the user into a new undo-workflow!
Stars: ✭ 107 (-9.32%)
Mutual labels:  serialization
Java
jsoniter (json-iterator) is fast and flexible JSON parser available in Java and Go
Stars: ✭ 1,308 (+1008.47%)
Mutual labels:  serialization
Typical
Typical: Fast, simple, & correct data-validation using Python 3 typing.
Stars: ✭ 111 (-5.93%)
Mutual labels:  serialization
Protobuf Nim
Protobuf implementation in pure Nim that leverages the power of the macro system to not depend on any external tools
Stars: ✭ 90 (-23.73%)
Mutual labels:  serialization
Yamldotnet
YamlDotNet is a .NET library for YAML
Stars: ✭ 1,382 (+1071.19%)
Mutual labels:  serialization
Symfony Jsonapi
JSON API Transformer Bundle for Symfony 2 and Symfony 3
Stars: ✭ 114 (-3.39%)
Mutual labels:  serialization
Datafiles
A file-based ORM for Python dataclasses.
Stars: ✭ 113 (-4.24%)
Mutual labels:  serialization
Protobuf
Protocol Buffers - Google's data interchange format
Stars: ✭ 52,305 (+44226.27%)
Mutual labels:  serialization

GoDoc Build Status Coverage Status Report Card

Very fast, very unsafe serialization for Go

This package provides a fast way to load large amounts of data into Go structs. As shown in the benchmarks, memdump can load datasets containing millions of small structs at over 1 GB/s.

However, the price you pay for decoding performance is:

  • you cannot load structs that contain maps or interfaces
  • data migration is not supported
  • your data is not portable across machine architectures (64 bit vs 32 bit, big-endian vs small-endian)
  • encoding performance is merely on par with typical json or gob performance

Memdump was designed for use in a caching layer, where the data was encoded and decoded by the same machine, and where decoding performance mattered more than encoding performance.

Benchmarks

The benchmarks were measured by encoding and decoding a tree containing 2,097,151 nodes. See below for further details.

Decode

                 gob    28.17 MB/s      (39.8 MB in 1.41s)
                json    30.17 MB/s      (113.8 MB in 3.77s)
             memdump  1031.54 MB/s      (113.2 MB in 0.11s)

Encode

                 gob    37.07 MB/s      (39.8 MB in 1.07s)
                json    77.20 MB/s      (113.8 MB in 1.47s)
             memdump    61.25 MB/s      (113.2 MB in 1.85s)

The tree nodes were as follows:

type treeNode struct {
	Label    string
	Weight   int
	Path     []pathComponent
	Children []*treeNode
}

To reproduce these results:

$ go get -u github.com/alexflint/go-memdump
$ go build github.com/alexflint/go-memdump/bench
$ ./bench

Quick start

go get github.com/alexflint/go-memdump

Write data to a file:

type data struct {
	Foo string
	Bar int
}

w, err := os.Create("/tmp/data.memdump")
if err != nil {
	...
}

// note that you must pass a pointer when encoding
mydata := data{Foo: "abc", Bar: 123}
memdump.Encode(w, &mydata)

Load data from a file:

r, err := os.Open("/tmp/data.memdump")
if err != nil {
	...
}

// note that you muss pass a pointer to a pointer when decoding
var mydata *data
memdump.Decode(r, &mydata)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].