通信中使用的数据格式(xml,json,pb.msgpack)
2017-01-04 22:02
603 查看
增加新的传输格式:protobuf
见http://www.jianshu.com/p/0b6dde762107
本文转自http://lf6627926.iteye.com/blog/1412398
本实例中包括xml、json、pb、msgpack四种的通信格式,采用http通信格式
在实例中我只采用了一个java对象,数据量较小,所以差异并不是非常的明显,但足以说明问题。
客户端压缩后的byte数组的长度与耗时
pb client length:30 cost time:61
pb client length:30 cost time:28
pb client length:30 cost time:27
pb client length:30 cost time:28
服务端解压缩耗时:
cost time:37
xml client length:116 cost time:112
xml client length:116 cost time:47
xml client length:116 cost time:39
xml client length:116 cost time:38
cost time:99
json client length:52 cost time:139
json client length:52 cost time:136
json client length:52 cost time:138
json client length:52 cost time:136
cost time:132
msgpack client length:28 cost time:334
msgpack client length:28 cost time:191
msgpack client length:28 cost time:188
msgpack client length:28 cost time:189
cost time:269
见http://www.jianshu.com/p/0b6dde762107
本文转自http://lf6627926.iteye.com/blog/1412398
本实例中包括xml、json、pb、msgpack四种的通信格式,采用http通信格式
在实例中我只采用了一个java对象,数据量较小,所以差异并不是非常的明显,但足以说明问题。
客户端压缩后的byte数组的长度与耗时
pb client length:30 cost time:61
pb client length:30 cost time:28
pb client length:30 cost time:27
pb client length:30 cost time:28
服务端解压缩耗时:
cost time:37
xml client length:116 cost time:112
xml client length:116 cost time:47
xml client length:116 cost time:39
xml client length:116 cost time:38
cost time:99
json client length:52 cost time:139
json client length:52 cost time:136
json client length:52 cost time:138
json client length:52 cost time:136
cost time:132
msgpack client length:28 cost time:334
msgpack client length:28 cost time:191
msgpack client length:28 cost time:188
msgpack client length:28 cost time:189
cost time:269
相关文章推荐
- js event 事件冒泡和事件捕获详细介绍【转】
- javascript类型转换(javascript权威指南3.8节)
- javascript的入门概要
- JSP+Servlet中使用jspsmartupload.jar进行图片上传下载
- DOM事件的处理
- 浅谈HTML与javascript的入门
- 用 Chrome 开发者工具分析 javascript 的内存回收(GC)
- JS var命令容易产生的精彩bug
- 最大值[JSOI2008] 洛谷1198 线段树
- JS中的常量(基本数据类型)和内置对象
- js判断浏览器类型
- JavaScript的引入及词法结构
- 利用Tesseract实现javascript验证码识别
- JSON.parse()和JSON.stringify()使用介绍
- javascript基础数字间的求和
- 浅度理解JS基本知识
- AngualrJS中的scope
- 关于初涉JavaScript
- FastJson使用
- 颜文字XSS和无字母XSS