easyjson icon indicating copy to clipboard operation
easyjson copied to clipboard

Updated Benchmarks

Open ghost opened this issue 4 years ago • 2 comments

Hello,

Quoting from Benchmark Results

ffjson results are from February 4th, 2016, using the latest ffjson and go1.6. go/codec results are from March 4th, 2016, using the latest go/codec and go1.6.

Would you guys mind updating these numbers? 4 years old benchmark is most likely not accurate any longer.

ghost avatar Oct 09 '20 17:10 ghost

A late answer, but I think it's still relevant. I've launched a benchmark, the results of other libraries have improved, but easyjson is still the fastest. I also found a benchmark for json-iterator/go, don't know why they didn't add jsoniter to the results, but I did it.

Benchmark Results

Unmarshaling

lib json size MB/s allocs/op B/op
standard regular 101.13 207 10000
standard small 38.16 15 672
easyjson regular 408.37 126 9512
easyjson small 153.99 3 128
ffjson regular 271.97 141 9882
ffjson small 78.15 10 496
codec regular 333.69 434 12840
codec small 147.70 7 144
jsoniter regular 206.20 449 28692
jsoniter small 69.37 12 384

Marshaling, one goroutine.

lib json size MB/s allocs/op B/op
standard regular 522.47 1 9473
standard small 204.60 1 96
standard large 508.09 1 450627
easyjson regular 903.73 10 10303
easyjson* regular 1085.43 9 721
easyjson small 504.21 1 128
easyjson large 934.43 28 457399
easyjson* large 1157.64 25 2211
ffjson regular 441.14 151 20815
ffjson** regular 477.49 150 4415
ffjson small 157.35 5 384
ffjson** small 189.49 4 128
ffjson large 450.38 7212 762209
ffjson** large 431.58 7214 761326
codec regular 373.13 9 35200
codec*** regular 511.02 0 0
codec small 181.18 1 1024
codec*** small 340.84 0 0
codec large 401.56 24 2298881
codec*** large 519.41 0 1659
jsoniter regular 149.37 12 29211
jsoniter small 79.86 4 328
jsoniter large 152.12 40 1387533

* marshaling to a writer, ** using ffjson.Pool(), *** reusing output slice instead of resetting it to nil

Marshaling, concurrent.

lib json size MB/s allocs/op B/op
standard regular 1339.92 1 9474
standard small 733.19 1 96
standard large 1579.63 1 450927
easyjson regular 4519.22 9 10210
easyjson* regular 4261.50 9 723
easyjson small 1513.28 1 128
easyjson large 2957.90 31 462411
easyjson* large 4314.01 25 2271
ffjson regular 1343.47 151 20837
ffjson** regular 1724.99 150 4438
ffjson small 430.05 5 384
ffjson** small 563.40 4 128
ffjson large 1078.97 7217 835397
ffjson** large 434.00 7214 758387
codec regular 1168.99 9 35200
codec*** regular 1863.45 0 0
codec small 443.25 1 1024
codec*** small 1145.33 0 0
codec large 948.98 24 2298897
codec*** large 1845.09 0 1791
jsoniter regular 509.79 12 29271
jsoniter small 277.85 4 328
jsoniter large 501.28 38 1420690

* marshaling to a writer, ** using ffjson.Pool(), *** reusing output slice instead of resetting it to nil

Here is results of UltraJSON benchmark, I don't know how to translate them to MB/s:

Python ujson module, DECODE: 5000 loops, best of 5: 47.7 usec per loop
Python ujson module, ENCODE: 10000 loops, best of 5: 37.9 usec per loop

luminosoda avatar Aug 06 '21 13:08 luminosoda

@luminosoda thanks for publishing this. Any chance you could add segmentio/encoding as well ?

ghost avatar Sep 07 '21 14:09 ghost