Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/arjunmahishi/jsoniter-vs-standard-package
- Owner: arjunmahishi
- Created: 2020-09-01T19:34:18.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-02T05:56:22.000Z (over 4 years ago)
- Last Synced: 2024-10-13T18:42:24.924Z (3 months ago)
- Topics: encoding, encoding-decoding, golang, json, jsoniter
- Language: Go
- Homepage: https://youtu.be/7ykQqbgXsJU
- Size: 168 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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
```