通信中使用的数据格式(xml,json,pb.msgpack)

增加新的传输格式: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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值