Golang json encoders\decoders benchmark

Overview

Json encoder and decoder benchmark

Test Encode for:

  1. Build-in encoder
  2. https://github.com/mailru/easyjson
  3. https://github.com/json-iterator/go

Test Decode with access to one field for:

  1. Build-in decoder
  2. https://github.com/mailru/easyjson
  3. https://github.com/json-iterator/go
  4. https://github.com/valyala/fastjson (only one field extracted)
  5. https://github.com/tidwall/gjson (only one field extracted)
  6. Parallel https://github.com/valyala/fastjson (only one field extracted)
  7. Parallel https://github.com/tidwall/gjson (only one field extracted)

Test Delete unnecessary field from json document without parsing it into structure:

  1. https://github.com/valyala/fastjson
  2. https://github.com/tidwall/sjson
  3. https://github.com/tidwall/sjson by setting necessary fields in new document (bad idea)
  4. https://github.com/tidwall/gjson by parse to map[interface{}]interface{}, delete fields and Marshal with jsoniter
goos: linux
goarch: amd64
pkg: github.com/satmaelstorm/jsonBenchmark
cpu: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
BenchmarkStdJsonEncode-12                 455626              2907 ns/op            1112 B/op          6 allocs/op
BenchmarkEasyJsonEncode-12               1000000              1325 ns/op             968 B/op          6 allocs/op
BenchmarkJsoniterJsonEncode-12           1000000              1960 ns/op            1112 B/op          6 allocs/op
BenchmarkStdJsonDecode-12                 228279              5276 ns/op             336 B/op         13 allocs/op
BenchmarkEasyJsonDecode-12                663830              1794 ns/op              42 B/op          8 allocs/op
BenchmarkJsoniterDecode-12                366958              3283 ns/op             664 B/op         29 allocs/op
BenchmarkFastJsonDecode-12               1634101               730.6 ns/op             0 B/op          0 allocs/op
BenchmarkGJsonDecode-12                  3851779               318.0 ns/op             3 B/op          1 allocs/op
BenchmarkFastJsonDecodeParallel-12       7178468               170.7 ns/op             0 B/op          0 allocs/op
BenchmarkGJsonDecodeParallel-12         17168725                69.63 ns/op            3 B/op          1 allocs/op
BenchmarkFastJsonDelete-12                426006              5862 ns/op            3916 B/op          9 allocs/op
BenchmarkSJsonDelete-12                    52360             43182 ns/op           38096 B/op         20 allocs/op
BenchmarkSJsonDeleteBySet-12               12549             97480 ns/op           37584 B/op         40 allocs/op
BenchmarkGJsonDeleteByMap-12               47029             35157 ns/op           19958 B/op         46 allocs/op

IMHO:

  1. If you need to encode or decode into a structure, and you want to avoid code generation, take jsoniter, otherwise, an easyjson one is a great way
  2. If you need a small number of fields from a clear location, you can take gjson
  3. If you need to remove fields from the json without decoding it - fastjson will do the best
Owner
Vladislav S
https://haddan.ru, https://rabota.ru
Vladislav S
Go benchmark harness.

autobench autobench is a framework to compare the performance of Go 1.2 and Go 1.3. usage autobench downloads and builds the latest Go 1.1 and Go tip

Dave Cheney 92 Nov 12, 2021
Go HTTP request router and web framework benchmark

Go HTTP Router Benchmark This benchmark suite aims to compare the performance of HTTP request routers for Go by implementing the routing structure of

Julien Schmidt 1.6k May 17, 2022
:zap: Go web framework benchmark

go-web-framework-benchmark This benchmark suite aims to compare the performance of Go web frameworks. It is inspired by Go HTTP Router Benchmark but t

smallnest 1.7k May 13, 2022
Key/Value database benchmark

USAGE: kvbench OPTIONS OVERVIEW kvbench is a simple benchmarking tool to evaluate the read performance of a key/value store while writes are being app

James A. Robinson 24 Nov 15, 2021
A rapid http(s) benchmark tool written in Go

gonetx/httpit httpit is a rapid http(s) benchmark tool which on top of fasthttp. Also thanks to cobra and bubbletea. Installation Get binaries from re

null 134 May 11, 2022
Go http server benchmark

go-http-server-benchmark The more connections, nbio cost the less memory, and performance the better than other frameworks. We can serve for 1000k or

lesismal 1 Oct 27, 2021
Go Script Lang Benchmark

Go Script Lang Benchmark git clone github.com/akkuman/go_script_lang_benchmark c

null 2 Feb 10, 2022
Go-driver-benchmark - Driver benchmark with golang

We use ClickkHouse for time-series databases, and the driver's performance is ve

null 3 Jan 27, 2022
Redis-benchmark - Simple get, mget and pipelined get benchmark.

redis-benchmark Simple get, mget and pipelined get benchmark. Usage git clone https://github.com/Ali-A-A/redis-benchmark.git cd ./redis-benchmark dock

Ali Abbasi Alaei 0 Dec 31, 2021
Benchmark - Benchmark of logr implementations

Benchmark of logr implementations Implementations a function (can bridge to non-

null 2 Mar 23, 2022
Golang json encoders\decoders benchmark

Json encoder and decoder benchmark Test Encode for: Build-in encoder https://github.com/mailru/easyjson https://github.com/json-iterator/go Test Decod

Vladislav S 0 Dec 3, 2021
Benchmark of Golang JSON Libraries

Introduction This is a benchmark for the json packages. You are welcome to open an issue if you find anything wrong or out of date. TL;DR In conclusio

null 6 Nov 15, 2021
Cache benchmark for Golang

Cache comparison benchmark for Go This benchmark compares cache algorithms using scrambled zipfian distribution (a few occur very often while many oth

Vladimir Mihailenco 39 May 5, 2022
Continuous Benchmark for cache libraries written in golang.

Simple performance comparison of cache libraries written in golang. Reports Continuous Bencmark Result (click here) Default parameters 256 shards * 32

bench+ 8 Mar 21, 2022
Go benchmark harness.

autobench autobench is a framework to compare the performance of Go 1.2 and Go 1.3. usage autobench downloads and builds the latest Go 1.1 and Go tip

Dave Cheney 92 Nov 12, 2021
Go HTTP request router and web framework benchmark

Go HTTP Router Benchmark This benchmark suite aims to compare the performance of HTTP request routers for Go by implementing the routing structure of

Julien Schmidt 1.6k May 17, 2022
:zap: Go web framework benchmark

go-web-framework-benchmark This benchmark suite aims to compare the performance of Go web frameworks. It is inspired by Go HTTP Router Benchmark but t

smallnest 1.7k May 13, 2022
Key/Value database benchmark

USAGE: kvbench OPTIONS OVERVIEW kvbench is a simple benchmarking tool to evaluate the read performance of a key/value store while writes are being app

James A. Robinson 24 Nov 15, 2021
A rapid http(s) benchmark tool written in Go

gonetx/httpit httpit is a rapid http(s) benchmark tool which on top of fasthttp. Also thanks to cobra and bubbletea. Installation Get binaries from re

null 134 May 11, 2022
:zap: Go web framework benchmark

go-web-framework-benchmark This benchmark suite aims to compare the performance of Go web frameworks. It is inspired by Go HTTP Router Benchmark but t

smallnest 1.7k May 18, 2022
A CLI to turn Go's benchmark output into pictures

benchdraw benchdraw allows you to make easy to read picture plots from data in Go's benchmark format, implemented in pure Go. Benchdraw does not try t

Jack Lindamood 342 Apr 28, 2022
Continuous Benchmark for Go Project

Abstract cob compares benchmarks between the latest commit (HEAD) and the previous commit (HEAD{@1}). The program will fail if the change in score is

Teppei Fukuda 356 May 6, 2022
Redis Sorted Sets Benchmark

redis-zbench-go Redis Sorted Sets Benchmark Overview This repo contains code to trigger load ( ZADD ) or query (ZRANGEBYLEX key min max) benchmarks, w

filipe oliveira 3 May 18, 2021
Open Source runtime scanner for Linux containers (LXD), It performs security audit checks based on CIS Linux containers Benchmark specification

lxd-probe Scan your Linux container runtime !! Lxd-Probe is an open source audit scanner who perform audit check on a linux container manager and outp

Chen Keinan 12 Dec 27, 2021
Test and benchmark KPHP code

Overview ktest is a tool that makes kphp programs easier to test. ktest phpunit can run PHPUnit tests using KPHP ktest bench run benchmarks using KPHP

VK.com 7 Dec 7, 2021
Open Source runtime scanner for OpenShift cluster and perform security audit checks based on CIS RedHat OpenShift Benchmark specification

OpenShift-Ordeal Scan your Openshift cluster !! OpenShift-Ordeal is an open source audit scanner who perform audit check on OpenShift Cluster and outp

chenk 4 Apr 17, 2022
This benchmark provides a overview of the different SQLite driver performances available in Go.

SQLite/HTTP Server Performance Benchmark This benchmark provides a overview of the different SQLite driver performances available in Go. For benchmark

Philipp Tanlak 1 Dec 2, 2021
A benchmark suite aims to compare the performance of HTTP request routers for Go

Go HTTP Router Benchmark This benchmark suite aims to compare the performance of HTTP request routers for Go by implementing the routing structure of

null 3 Oct 25, 2021
Go http server benchmark

go-http-server-benchmark The more connections, nbio cost the less memory, and performance the better than other frameworks. We can serve for 1000k or

lesismal 1 Oct 27, 2021