Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/arjunmahishi/jsoniter-vs-standard-package

This is a benchmark in go to compare the performance of standard package encoding/json and jsoniter
https://github.com/arjunmahishi/jsoniter-vs-standard-package

encoding encoding-decoding golang json jsoniter

Last synced: about 2 months ago
JSON representation

This is a benchmark in go to compare the performance of standard package encoding/json and jsoniter

Awesome Lists containing this project

README

        

# encoding/json vs jsoniter

This is a benchmark in go to compare the performance of standard package `encoding/json` and `jsoniter`. This repo is complimentary to [this video](https://youtu.be/7ykQqbgXsJU).

## How to Run

```bash
go test -bench ""
```

## Result

```bash
$ go test -bench ".*"
goos: linux
goarch: amd64
BenchmarkJSONMarshalSmall-4 30000 48131 ns/op
BenchmarkJSONMarshalMed-4 1000 1214124 ns/op
BenchmarkJSONMarshalLarge-4 200 8338271 ns/op
BenchmarkJSONUnmarshalSmall-4 30000 49919 ns/op
BenchmarkJSONUnmarshalMed-4 1000 1257659 ns/op
BenchmarkJSONUnmarshalLarge-4 200 8570177 ns/op
BenchmarkJSONIterMarshalSmall-4 500000 2127 ns/op
BenchmarkJSONIterMarshalMed-4 30000 42359 ns/op
BenchmarkJSONIterMarshalLarge-4 3000 519634 ns/op
BenchmarkJSONIterUnmarshalSmall-4 100000 23554 ns/op
BenchmarkJSONIterUnmarshalMed-4 1000 1239436 ns/op
BenchmarkJSONIterUnmarshalLarge-4 500 4094496 ns/op
PASS
```