Skip to content

heshed/benchmark-go-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

benchmark-go-json

benchmark-go-json


subject

  • I want to check unmarshal performance for each json library.

json libraries (2020-09)

machine environment

Model Name: MacBook Pro
Model Identifier: MacBookPro16,1
Processor Name: 8-Core Intel Core i9
Processor Speed: 2.4 GHz
Number of Processors: 1
Total Number of Cores: 8
L2 Cache (per Core): 256 KB
L3 Cache: 16 MB
Hyper-Threading Technology: Enabled
Memory: 32 GB

Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz

usage

# go version go1.15 darwin/amd64
go test bench=.

benchmark

➜  benchmark-go-json git:(master) ✗ go test -bench=. 
BenchmarkJsonIteratorDecode-16                   5480703               216 ns/op             664 B/op          3 allocs/op
BenchmarkStdJsonDecode-16                        5088841               234 ns/op             864 B/op          2 allocs/op
BenchmarkJsonFFJsonDecodeReader-16               4593306               248 ns/op             864 B/op          2 allocs/op
BenchmarkAWSJsonSDK-16                           4017230               282 ns/op             880 B/op          3 allocs/op
BenchmarkJsonIteratorUnmarshal-16                3103564               357 ns/op              16 B/op          2 allocs/op
BenchmarkDecodeJson-16                           2826174               445 ns/op            1008 B/op          5 allocs/op
BenchmarkGjsonUnmarshal-16                       1231782              1007 ns/op             687 B/op          4 allocs/op
BenchmarkUgorjiJsonCodec-16                      1000000              1218 ns/op            1088 B/op          4 allocs/op
BenchmarkJsonFFJsonDecode-16                      682381              1731 ns/op             304 B/op          9 allocs/op
BenchmarkStdJsonUnmarshal-16                      710850              1737 ns/op             304 B/op          9 allocs/op
BenchmarkJsonFFJsonUnmarshal-16                   699499              1772 ns/op             304 B/op          9 allocs/op
BenchmarkFastJsonParseAndUnmarshal-16             643364              1888 ns/op            2018 B/op         15 allocs/op
ok      github.com/heshed/benchmark-go-json     17.796s

Considerations

Due to its usability, it was excluded from the test.

fastjson, gjson didn't provide unmarshaling functionality, so it only did parsing.

About

benchmark-go-json

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages