Python下MsgPack与Protocol Buffer性能比较

在Python 3.6.1环境下,对比了Protocol Buffer 3.5.2post1和MsgPack 0.5.6的性能。结果显示,Protocol Buffer的序列化速度大约是MsgPack的4倍,而MsgPack的反序列化速度是Protocol Buffer的2倍。此外,Protocol Buffer序列化的数据包大小约为MsgPack的1/6。
摘要由CSDN通过智能技术生成
  • Python版本: 3.6.1
  • Protocol Buffer版本: 3.5.2post1
  • MsgPack版本: 0.5.6

Protocol Buffer与MsgPack均为C扩展版

proto文件:

syntax = "proto3";

message TestPacket {
    int32 a = 1;
    int64 b = 2;
    float c = 3;
    string d = 4;
    uint64 e = 5;
    string f = 6;
    int32 g = 7;
}

python文件:

import msgpack
import uuid
import time
from protobuf.client import test_pb2 as t
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值