Skip to content

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

Notifications You must be signed in to change notification settings

arjunmahishi/jsoniter-vs-standard-package

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

How to Run

go test -bench "<regex of benchmark name>"

Result

 $ 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

About

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

Topics

Resources

Stars

Watchers

Forks

Languages