Closed MaxWk closed 3 years ago
我们在线上跑的cpu一直在80%以上,我用火焰图看了一下,发现json decode这块占用非常高。后面看到一些分析说json-iterator 这个三方库相比go的原声库性能已经不占优势了。 参考: https://my.oschina.net/childewang/blog/3029203 https://github.com/json-iterator/go/issues/320
Json 编解码性能的确是不太行, 不管哪个库. 不过既然Go原生库在某些场景下更好, 那的确是可以试一下换到原生库.
测试了一波,go1.13.15 下原生比目前cpu反而更高。所以根本原因应该还是decode成map而不是struct。这里也没什么好的解决方案。这个issue先关了吧
我们在线上跑的cpu一直在80%以上,我用火焰图看了一下,发现json decode这块占用非常高。后面看到一些分析说json-iterator 这个三方库相比go的原声库性能已经不占优势了。 参考: https://my.oschina.net/childewang/blog/3029203 https://github.com/json-iterator/go/issues/320