• Stars
    star
    403
  • Rank 107,140 (Top 3 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created about 9 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

⚡ Golang Serializer Benchmark Comparison

Golang Serialization Benchmark

Serializers

This project test the below go serializers, which compares with go standard json and xml.

Excluded Serializers

Given existed benchmark by alecthomas,or complexity, or activity, the below serializers are excluded from this test because of their poor performance.

Test Environment

go version: 1.13.4

Test:

go test -bench=.

Test Data Model

All tests are using the same data model as below:

type ColorGroup struct {
    ID     int `json:"id" xml:"id,attr""`
    Name   string `json:"name" xml:"name"`
    Colors []string `json:"colors" xml:"colors"`
}
`

Benchmark

Marshal

include marshalled bytes The test machine is the MacBook Pro 16 with i7 2.6GHz and 32G 2667MHz DDR4 memory. The test command we use is go test -benchtime=5s -bench=. -benchmem

BenchmarkMarshalByJson-128                        	14734310	       410.2 ns/op	        65.00 marshaledBytes	     128 B/op	       2 allocs/op
BenchmarkMarshalByXml-128                         	 1578195	      3735 ns/op	       137.0 marshaledBytes	    4736 B/op	      11 allocs/op
BenchmarkMarshalByMsgp-128                        	60867415	        90.96 ns/op	        47.00 marshaledBytes	      80 B/op	       1 allocs/op
BenchmarkMarshalByProtoBuf-128                    	18273046	       327.0 ns/op	        36.00 marshaledBytes	      64 B/op	       2 allocs/op
BenchmarkMarshalByGogoProtoBuf-128                	65710664	        90.39 ns/op	        36.00 marshaledBytes	      48 B/op	       1 allocs/op
BenchmarkMarshalByThrift-128                      	21794796	       273.7 ns/op	        63.00 marshaledBytes	      64 B/op	       1 allocs/op
BenchmarkMarshalByThriftIterator-128              	14869611	       402.6 ns/op	        63.00 marshaledBytes	     248 B/op	       6 allocs/op
BenchmarkMarshalByThriftIteratorDynamic-128       	14203106	       423.2 ns/op	        63.00 marshaledBytes	     200 B/op	       5 allocs/op
BenchmarkMarshalByThriftIteratorEncoder-128       	22899847	       295.3 ns/op	        63.00 marshaledBytes	     187 B/op	       0 allocs/op
BenchmarkMarshalByAvro-128                        	20259181	       297.5 ns/op	        32.00 marshaledBytes	     112 B/op	       2 allocs/op
BenchmarkMarshalByGencode-128                     	165538641	        35.88 ns/op	        34.00 marshaledBytes	       0 B/op	       0 allocs/op
BenchmarkMarshalByUgorjiCodecAndCbor-128          	 5353467	      1103 ns/op	        47.00 marshaledBytes	    1504 B/op	       6 allocs/op
BenchmarkMarshalByUgorjiCodecAndMsgp-128          	 5484471	      1093 ns/op	        47.00 marshaledBytes	    1504 B/op	       6 allocs/op
BenchmarkMarshalByUgorjiCodecAndBinc-128          	 5455846	      1104 ns/op	        47.00 marshaledBytes	    1504 B/op	       6 allocs/op
BenchmarkMarshalByUgorjiCodecAndJson-128          	 4621263	      1291 ns/op	        65.00 marshaledBytes	    1584 B/op	       6 allocs/op
BenchmarkMarshalByEasyjson-128                    	27812725	       215.5 ns/op	        65.00 marshaledBytes	     128 B/op	       1 allocs/op
BenchmarkMarshalByFfjson-128                      	 5023614	      1190 ns/op	        65.00 marshaledBytes	     412 B/op	       9 allocs/op
BenchmarkMarshalByJsoniter-128                    	17086744	       350.6 ns/op	        65.00 marshaledBytes	      88 B/op	       2 allocs/op
BenchmarkMarshalBySonic-128                       	20919127	       288.6 ns/op	        65.00 marshaledBytes	     198 B/op	       4 allocs/op
BenchmarkMarshalByGojay-128                       	13831465	       430.9 ns/op	        65.00 marshaledBytes	     538 B/op	       2 allocs/op
BenchmarkMarshalByGoMemdump-128                   	 1550764	      3864 ns/op	       200.0 marshaledBytes	    1512 B/op	      27 allocs/op
BenchmarkMarshalByColfer-128                      	216226507	        27.93 ns/op	        35.00 marshaledBytes	       0 B/op	       0 allocs/op
BenchmarkMarshalByZebrapack-128                   	46097662	       133.0 ns/op	       109.0 marshaledBytes	     186 B/op	       0 allocs/op
BenchmarkMarshalByHprose-128                      	25639276	       233.2 ns/op	        49.00 marshaledBytes	      24 B/op	       1 allocs/op
BenchmarkMarshalBySereal-128                      	 3448252	      1724 ns/op	        76.00 marshaledBytes	     728 B/op	      22 allocs/op
BenchmarkMarshalByVmihMsgpackv4-128               	11608585	       516.2 ns/op	        55.00 marshaledBytes	     232 B/op	       5 allocs/op
BenchmarkMarshalByRlp-128                         	22588225	       266.8 ns/op	        32.00 marshaledBytes	      64 B/op	       3 allocs/op
BenchmarkMarshalBySegmentioJSON-128               	 9633194	       623.1 ns/op	        65.00 marshaledBytes	    1072 B/op	       2 allocs/op

Unmarshal

BenchmarkUnmarshalByJson-128                      	 3697374	      1631 ns/op	     264 B/op	      10 allocs/op
BenchmarkUnmarshalByXml-128                       	  638480	      9316 ns/op	    2946 B/op	      70 allocs/op
BenchmarkUnmarshalByMsgp-128                      	44057836	       135.5 ns/op	      32 B/op	       5 allocs/op
BenchmarkUnmarshalByProtoBuf-128                  	 9628360	       620.3 ns/op	     176 B/op	      11 allocs/op
BenchmarkUnmarshalByGogoProtoBuf-128              	16364524	       370.0 ns/op	     160 B/op	      10 allocs/op
BenchmarkUnmarshalByThrift-128                    	10060344	       591.0 ns/op	      96 B/op	       6 allocs/op
BenchmarkUnmarshalByThriftIterator-128            	14740503	       407.5 ns/op	     168 B/op	       7 allocs/op
BenchmarkUnmarshalByThriftIteratorDynamic-128     	 5471894	      1098 ns/op	     592 B/op	      18 allocs/op
BenchmarkUnmarshalByThriftIteratorDecoder-128     	 5110819	      1162 ns/op	     616 B/op	      19 allocs/op
BenchmarkUnmarshalByAvro-128                      	  281683	     21232 ns/op	   12305 B/op	     232 allocs/op
BenchmarkUnmarshalByGencode-128                   	59231443	        99.60 ns/op	      32 B/op	       5 allocs/op
BenchmarkUnmarshalByUgorjiCodecAndCbor-128        	 5306976	      1128 ns/op	     656 B/op	       8 allocs/op
BenchmarkUnmarshalByUgorjiCodecAndMsgp-128        	 4681980	      1284 ns/op	     768 B/op	      10 allocs/op
BenchmarkUnmarshalByUgorjiCodecAndBinc-128        	 5368308	      1118 ns/op	     656 B/op	       8 allocs/op
BenchmarkUnmarshalByUgorjiCodecAndJson-128        	 3233894	      1865 ns/op	    1168 B/op	      10 allocs/op
BenchmarkUnmarshalByEasyjson-128                  	16066514	       371.5 ns/op	      32 B/op	       5 allocs/op
BenchmarkUnmarshalByFfjson-128                    	 3694323	      1620 ns/op	     474 B/op	      13 allocs/op
BenchmarkUnmarshalByJsoniter-128                  	16905810	       354.9 ns/op	      32 B/op	       5 allocs/op
BenchmarkUnmarshalBySonic-128                     	24124342	       247.9 ns/op	      99 B/op	       1 allocs/op
BenchmarkUnmarshalByGojay-128                     	 9106419	       659.9 ns/op	     281 B/op	       9 allocs/op
BenchmarkUnmarshalByGoMemdump-128                 	 9233306	       655.1 ns/op	     736 B/op	       9 allocs/op
BenchmarkUnmarshalByColfer-128                    	34182229	       175.7 ns/op	      96 B/op	       6 allocs/op
BenchmarkUnmarshalByZebrapack-128                 	29730520	       195.6 ns/op	      32 B/op	       5 allocs/op
BenchmarkUnmarshalByHprose-128                    	11646049	       517.5 ns/op	     272 B/op	       9 allocs/op
BenchmarkUnmarshalBySereal-128                    	12377004	       480.3 ns/op	      80 B/op	       6 allocs/op
BenchmarkUnmarshalByVmihMsgpackv4-128             	 7308202	       818.5 ns/op	     264 B/op	      11 allocs/op
BenchmarkUnmarshalByRlp-128                       	 9474120	       634.5 ns/op	     104 B/op	      11 allocs/op
BenchmarkUnmarshalBySegmentioJSON-128             	14143380	       421.1 ns/op	      32 B/op	       5 allocs/op

Marshaled Size

More Repositories

1

rpcx

Best microservices framework in Go, like alibaba Dubbo, but with more features, Scale easily. Try it. Test it. If you feel it's better, use it! 𝐉𝐚𝐯𝐚有𝐝𝐮𝐛𝐛𝐨, 𝐆𝐨𝐥𝐚𝐧𝐠有𝐫𝐩𝐜𝐱! build for cloud!
Go
7,712
star
2

go-web-framework-benchmark

⚡ Go web framework benchmark
Go
1,915
star
3

1m-go-tcp-server

benchmarks for implementation of servers which support 1 million connections
Go
1,840
star
4

dive-to-gosync-workshop

深入Go并发编程研讨课
Go
1,618
star
5

C1000K-Servers

⚡ High performance websocket servers implemented by Spray-can, Netty, undertow, jetty, Vert.x, Grizzly, node.js and Go. It supports 1,200,000 active websocket connections
Scala
1,506
star
6

gen

Converts a database into gorm structs and RESTful api
Go
1,428
star
7

concurrency-programming-via-rust

Rust
1,296
star
8

chanx

unbounded chan
Go
425
star
9

ringbuffer

a thread-safe circular buffer (ring buffer) in Go, implemented io.ReaderWriter interface
Go
412
star
10

gofsm

a featured FSM that can export state images
Go
297
star
11

go-best-practices

resources for go best practices
289
star
12

douban-recommender

基于Spark ML实现的豆瓣电影推荐系统
Scala
224
star
13

rpcx-ui

rpcx manager web ui
Go
215
star
14

gotips

Go tips from Phuong Le. Go语言编程技巧
189
star
15

Jax-RS-Performance-Comparison

⚡ Performance Comparison of Jax-RS implementations and embedded containers
Java
187
star
16

weighted

high-performance common weighted algorithm library
Go
185
star
17

ZKRecipesByExample

all examples for ZooKeeper recipes by Curator
Java
183
star
18

go-concurrent-quiz

Go concurrency quizzes
Go
170
star
19

goframe

send/receive framed data via TCP or QUIC
Go
167
star
20

kafka-example-in-scala

a kafka producer and consumer example in scala and java
Java
152
star
21

ebooks

制作的电子书越来越多,找个仓库放置,方便下载
149
star
22

rpcx-programming-guide-cn

gitbook Go RPC开发指南 [中文文档]
CSS
142
star
23

glean

hotfix for go applications via plugin, supports Linux and MacOS
Go
130
star
24

rpcx-rs

rpcx microservice framework in Rust
Rust
126
star
25

queue

lock-free queue and other implementations
Go
126
star
26

goreq

A Simplified Golang Http Client
Go
104
star
27

go_test_workshop

Go Test Workshop
HTML
100
star
28

gofer

Go
95
star
29

channels

go channel patterns
Go
89
star
30

resp3

First redis RESP3 protocol library in Go
Go
85
star
31

smallchat

A minimal programming example for a chat server in Go and Rust
Rust
81
star
32

epoller

epoll implementation for connections in Linux, MacOS and Windows
C
80
star
33

rpcx-java

rpcx implementation in Java for server side and client side
Java
79
star
34

grpc-examples

examples for gRPC
Go
63
star
35

exp

Experimental packages not in std and golang.org/exp
Go
63
star
36

distributed

distributed synchronization primitives
Go
60
star
37

leetcode-solutions

leetcode 算法题解精选
46
star
38

FlyRunner

一个记录你地图路线的跑步软件,无需google map支持
Java
44
star
39

rpcxdump

a tcpdump-like tool to capture rpcx tcp packets
Go
43
star
40

hash-bench

go hash benchmark
Go
41
star
41

zhuge

救命用的profile
Go
41
star
42

mping

a multi-targets ping tool, which supports 10,000 packets/second, accurate latency
Go
40
star
43

spring-kafka-demo

Java
37
star
44

Tractor

A Tractor game. (升级,一个在中国非常流行的扑克牌游戏。又叫拖拉机,双扣)。 Developed by C#
C#
37
star
45

network_benchmark

3百万QPS benchmark测试
Go
34
star
46

mping-rs

a multi-targets ping tool and library, which supports 10,000 packets/second, accurate latency
Rust
34
star
47

mahout-douban-recommender

基于mahout实现的豆瓣电影推荐系统
Java
33
star
48

RPC-TEST

test performance of gRPC and Thrift. All services are implemented as HelloWorld by Java, Scala and Golang
Shell
30
star
49

breakdown

记录国内外互联网公司和电信企业P0级别的重大故障
28
star
50

quick

an encrypted UDP connection between two peers using QUIC
Go
26
star
51

talk-about-go-generics

谈谈Go泛型 - GopherChina 2023 大会分享
Go
25
star
52

concurrency-programming-via-go-code

code of concurrency programming via go
Go
25
star
53

pping-go

使用Go语言实现pping
Go
19
star
54

gitalk

gitalk for colobu
19
star
55

fastjson-jaxrs-json-provider

a JAX-RS entity provider for https://github.com/alibaba/fastjson
Java
18
star
56

redis-bench

a different redis bench tool that is used for test latency at given max throughputs
Go
16
star
57

iprange

check whether a IP is in IP ranges with CIDR format such as 216.249.16.0/20 and 2a01:5a80::/32
Go
16
star
58

rpcxlite

a lite version of rpcx
Go
16
star
59

smallnest.github.io

HTML
16
star
60

leetcode

有空就刷题
Go
14
star
61

syncx

more advanced sync primitives in Go
Go
14
star
62

kafka_monitor

A kafka monitor to send alarm emails
Go
14
star
63

rediscopy

copy redis requests to other servers
Go
14
star
64

weighted-rs

A Rust library for weighted balancing algorithm
Rust
12
star
65

gomemcached

memcached protocol implementation for memcached server
Go
12
star
66

slog-exp

slog experimental features
Go
11
star
67

rpcx-agent

Agent to invoke rpcx services in C++, Java, Python, C#, Ruby, etc. for rpcx 2.x
Go
10
star
68

gofu

functional go with generic types
10
star
69

libra-wallet

a libra wallet example in go
HTML
9
star
70

qianmo

additional network functions
Go
9
star
71

rust-examples

study rust by examples
Rust
9
star
72

rpcx-programming-guide-en

rpcx programming guide (english version)
9
star
73

Ember-Lance

Dashboard Bootstrap implemented with sb-admin2, Ember, D3.js and other third-party libraries
JavaScript
9
star
74

DisruptorBootstrap

Example for Disruptor and Spring Reactor
Java
8
star
75

nettrace.bak

explore internal/nettrace in go std lib
Go
8
star
76

go-app-metrics

add system monitor (cpu/load/memory/disk/bandwidth) to go-metrics
Go
7
star
77

blockchain

a general blockchain implementation
Go
7
star
78

go-cheatsheets

7
star
79

go-generics-examples

go generics examples
Assembly
7
star
80

preallocate

File preallocation library, cloned from https://git.sr.ht/~tslocum/preallocate
Go
6
star
81

pool

a go pool that you don't worry about GC
Go
5
star
82

libp2p

a secure go p2p libary, easy to use. cloned from go-spacemesh
Go
5
star
83

libkv-etcdv3-store

libkv etcd store by client v3 API: https://github.com/docker/libkv
Go
5
star
84

benchpi

rust examples for calculating PI
Rust
4
star
85

json-parser-benchmark

json parser benchmark
Go
4
star
86

Java-Memcached-Clients-Benchmark

⚡ Benchmark for Java Memcached clients such as SpyMemcached, XMemcached and folsom
Scala
4
star
87

p2p

p2p examples
Go
4
star
88

word

一个命令行中查找英语单词的意思和发音
Go
4
star
89

kafka-go-examples

examples for kafka go clients
Go
3
star
90

golang-tls

golang tls for http/http2 examples
Go
3
star
91

tracert

a special traceroute lib for multiple paths by UDP
Go
3
star
92

awesome-web-templates

record free web templates
3
star
93

concurrency-programming-via-go

Go并发编程勘误页和问题反馈
2
star
94

Scala-Collections-Cookbook

codes for the book "Scala Collections Cookbook"
Scala
2
star
95

libra-wallet-rust

libra wallet in rust
CSS
2
star
96

batch

batch process or timeout
Go
2
star
97

shorturl

a scalable high performance ShortURL server
Scala
2
star
98

go-database-study

study golang database lib
Go
2
star
99

bitcoin

bitcoin study
Go
2
star
100

ai_assistant

熊厂内分享,github copilot vs baidu comate
Go
1
star