protocol buffers vs json vs XML
2015-06-10 17:56
316 查看
原创文章转载请注明出处:@协思, http://zeeman.cnblogs.com
在分布式系统中,数据序列化传递的情形非常常见,主流的三种,JSON、XML、Protobuf。
XML现在已经很少使用,除非要和遗留系统交互。
JSON用在前端交互和跨组织的API的交互场合比较多。
对于内部系统,特别是性能敏感的区域,推荐使用Protobuf,可以得到最快的序列化速度和最小的结果。
参考资料: http://stackoverflow.com/questions/14028293/google-protocol-buffers-vs-json-vs-xml
Json
human readable/editable
can be parsed without knowing schema in advance
excellent browser support
less verbose than XML
XML
human readable/editable
can be parsed without knowing schema in advance
standard for SOAP etc
good tooling support (xsd, xslt, sax, dom, etc)
pretty verbose
Protobuf
very dense data (small output)
hard to robustly decode without knowing the schema (data format is internally ambiguous, and needs schema to clarify)
very fast processing
not intended for human eyes (dense binary)
All have good support on most platforms.
在分布式系统中,数据序列化传递的情形非常常见,主流的三种,JSON、XML、Protobuf。
XML现在已经很少使用,除非要和遗留系统交互。
JSON用在前端交互和跨组织的API的交互场合比较多。
对于内部系统,特别是性能敏感的区域,推荐使用Protobuf,可以得到最快的序列化速度和最小的结果。
参考资料: http://stackoverflow.com/questions/14028293/google-protocol-buffers-vs-json-vs-xml
Json
human readable/editable
can be parsed without knowing schema in advance
excellent browser support
less verbose than XML
XML
human readable/editable
can be parsed without knowing schema in advance
standard for SOAP etc
good tooling support (xsd, xslt, sax, dom, etc)
pretty verbose
Protobuf
very dense data (small output)
hard to robustly decode without knowing the schema (data format is internally ambiguous, and needs schema to clarify)
very fast processing
not intended for human eyes (dense binary)
All have good support on most platforms.
相关文章推荐
- PHP Warning: date() [function.date]: It is not safe to rely on the system's timezone
- nodejs全局变量
- [技巧篇]00.TrimFilter去掉jsp页面空白,提升访问速度
- JS事件
- StrSafe.h 使用安全字符串操作函数
- JavaScript中清空数组的三种方式
- html DIV元素左右偏移方法,偏移后默认宽度仍浏览器宽度一致
- JQuery鼠标移到小图显示大图效果的方法
- js 继承
- JQuery采纳CSS实现DOM显示和隐藏要素
- 记一个发HTML格式邮件的问题
- HTML5 文字及图片标签解析
- JS操作DOM元素属性和方法(转)
- CSS计数器的趣味时光
- JavaScript 正则表达式上——基本语法
- jQuery 自动完成文本框
- nodejs supervisor
- javascript 全选 反选 js代码
- LIfeAsia国内的开发现象浅见
- js中substring和substr的用法