快速JSON序列化 Easyjson

码农软件 · 软件分类 · 其他开发相关 · 2019-10-18 16:28:52

软件介绍

Easyjson用于序列化JSON数据,采用Go语言编写,而不是通过使用反射生成编组代码。一个库的目的之一是使所生成的代码足够简单,使得它可以容易地优化或固定。另一个目标是为用户提供不可定制的“encoding/json”,如产生snake_case名称或启用默认“omitempty“生成代码。

用法:

go get github.com/mailru/easyjson/...
easyjson -all <file>.go

这将利用编组/解组方法结构生成<file>_easyjson.go

限制:

  • The library is at an early stage, there are likely to be some bugs and some features of 'encoding/json' may not be supported. Please report such cases, so that they may be fixed sooner.

  • Unsafe package is used by the code. While a non-unsafe version of easyjson can be made in the future, using unsafe package simplifies a lot of code by allowing to use 'switch' for filling out structs and working around limitations of standard functions like 'strconv.ParseInt'.

  • Floats are currently formatted with default precision for 'strconv' package. It is obvious that it is not always the correct way to handle it, but there aren't enough use-cases for floats at hand to do anything better.

  • During parsing, parts of JSON that are skipped over are not syntactically validated more than required to skip matching parentheses.

  • No true streaming support for encoding/decoding. For many use-cases and protocols, data length is typically known on input and needs to be known before sending the data.

解析:

libjson sizeMB/sallocs/opB/op
standardregular2221810229
standardsmall9.714720
-------------------------------------------
easyjsonregular1251289794
easyjsonsmall673128
-------------------------------------------
ffjsonregular661419985
ffjsonsmall17.610488
-------------------------------------------
codecregular5543419299
codecsmall297336
-------------------------------------------
ujsonregular103N/AN/A

编组,one goroutine

libjson sizeMB/sallocs/opB/op
standardregular75923256
standardsmall323328
standardlarge80171.2M
---------------------------------------------
easyjsonregular213910260
easyjson*regular2638742
easyjsonsmall1251128
easyjsonlarge21233490k
easyjson*large262252879
---------------------------------------------
ffjsonregular12215321340
ffjson**regular1461524897
ffjsonsmall365384
ffjson**small644128
ffjsonlarge1347317818k
ffjson**large1257320827k
---------------------------------------------
codecregular801733601
codec***regular10891153
codecsmall423304
codec***small56148
codeclarge734832.5M
codec***large10345166007
---------------------------------------------
ujsonregular92N/AN/A

编组,并发

libjson sizeMB/sallocs/opB/op
standardregular252923257
standardsmall1243328
standardlarge289171.2M
----------------------------------------------
easyjsonregular792910597
easyjson*regular17488779
easyjsonsmall3331128
easyjsonlarge71836548k
easyjson*large2134254957
---------------------------------------------
ffjsonregular30115321629
ffjson**regular7071525148
ffjsonsmall625384
ffjson**small2824128
ffjsonlarge43873301.0M
ffjson**large1317319820k
---------------------------------------------
codecregular1831733603
codec***regular67191157
codecsmall1473304
codec***small299148
codeclarge1904832.5M
codec***large75245177574


本文地址:https://www.codercto.com/soft/d/17038.html

数学建模算法与应用

数学建模算法与应用

司守奎、孙玺菁 / 国防工业出版社 / 2011-8 / 49.00元

《数学建模算法与应用》主要内容简介:作者司守奎、孙玺菁根据多年数学建模竞赛辅导工作的经验编写《数学建模算法与应用》,涵盖了很多同类型书籍较少涉及的新算法和热点技术,主要内容包括时间序列、支持向量机、偏最小二乘面归分析、现代优化算法、数字图像处理、综合评价与决策方法、预测方法以及数学建模经典算法等内容。《数学建模算法与应用》系统全面,各章节相对独立。《数学建模算法与应用》所选案例具有代表性,注重从不......一起来看看 《数学建模算法与应用》 这本书的介绍吧!

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具