Faster JSON serialization

594 views
Skip to first unread message

Victor Starodub

unread,
Mar 3, 2016, 12:05:53 AM3/3/16
to golang-nuts
Hi,

I've put up a library to do fast encoding/decoding of JSON for golang in an 'encoding/json' compatible way: https://github.com/mailru/easyjson. The library is similar in usage to https://github.com/pquerna/ffjson, but it is ~2x faster (and also less heavy on allocations) for both marshalling/unmarshalling. Also, golang finally beats ujson for decoding!

Also, I've added options to enable 'omitempty' and to use 'snake_case' field names by default during generation, since this behavior is used by quite a lot of APIs.

The library is currently in an early stage and any feedback would be much appreciated!

Victor

Henrik Johansson

unread,
Mar 3, 2016, 1:49:59 AM3/3/16
to Victor Starodub, golang-nuts
Looks interesting, will definitely try it.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

C Banning

unread,
Mar 3, 2016, 6:38:13 AM3/3/16
to golang-nuts
Can you add https://godoc.org/github.com/ugorji/go/codec to your benchmarks?

Matt Silverlock

unread,
Mar 3, 2016, 9:54:53 AM3/3/16
to golang-nuts
Neat—nice work + the README is thorough, which I like!

Consider re-running the suite here with easyjson added: https://github.com/alecthomas/go_serialization_benchmarks 

(you should, time permitting, submit what changes you can to ffjson too, since it's a popular lib!)

Victor Starodub

unread,
Mar 3, 2016, 9:29:51 PM3/3/16
to golang-nuts
I've added go/codec to benchmarks. It seems to be more-or-less similar in performance to ffjson, except for small requests. Though the bottlenecks are certainly different for those two libs.

четверг, 3 марта 2016 г., 21:38:13 UTC+10 пользователь C Banning написал:
Reply all
Reply to author
Forward
0 new messages