go 终于有一个快一点的JSON 库出来了 easyjson
easyjson
easyjson vs. encoding/json
easyjson seems to be 5-6 times faster than the default json serialization for unmarshalling, 3-4 times faster for non-concurrent marshalling. Concurrent marshalling is 6-7x faster if marshalling to a writer.
easyjson vs. ffjson
easyjson uses the same approach for code generation as ffjson, but a significantly different approach to lexing and generated code. This allows easyjson to be 2-3x faster for unmarshalling and 1.5-2x faster for non-concurrent unmarshalling.
ffjson seems to behave weird if used concurrently: for large request pooling hurts performance instead of boosting it, it also does not quite scale well. These issues are likely to be fixable and until that comparisons might vary from version to version a lot.
easyjson is similar in performance for small requests and 2-5x times faster for large ones if used with a writer.
easyjson vs 'ujson' python module
ujson is using C code for parsing, so it is interesting to see how plain golang compares to that. It is imporant to note that the resulting object for python is slower to access, since the library parses JSON object into dictionaries.
easyjson seems to be slightly faster for unmarshalling (finally!) and 2-3x faster for marshalling.
0
See Also
- 标准库里的json.marshal是线程安全的么
- 很简洁快速的一个论坛
- 一个浏览器可以同时登录2个帐号
- go+json 还是没有python+json 结合得完美,解析速度比python 慢
- aLiLua:一个lua web 框架
Nearby
- 上一篇 › 头像出不来怎么处理
- 下一篇 › Uber 与支付宝达成全球出行支付合作,以后境外可用人民币叫专车
test