快速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://codercto.com/soft/d/17038.html

矩阵计算

矩阵计算

Gene H. Golub、Charles F. Van Loan / 袁亚湘 / 人民邮电出版社 / 2009 / 89.00元

本书是国际上数值计算方面的权威著作,有“圣经”之称。被美国加州大学、斯坦福大学、华盛顿大学、芝加哥大学、中国科学院研究生院等很多世界知名学府用作相关课程的教材或主要参考书。 本书系统地介绍了矩阵计算的基本理论和方法。书中的许多算法都有现成的软件包实现,每节后还附有习题,并有注释和大量参考文献,非常有助于自学。一起来看看 《矩阵计算》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具