您的位置:首页 > Web前端 > JavaScript

通信中使用的数据格式(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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: