Protobuf与Avro的序列化性能测试

本文对比了Avro与Protobuf在性能上的差异,包括生成文件和序列化但不生成文件两个测试场景。测试结果显示,Protobuf在速度上比Avro快2~4倍。Avro在不生成文件时表现更慢,可能与其处理方式有关,而Protobuf的不同接入方法也影响了效率。
摘要由CSDN通过智能技术生成

Avro与Protobuf性能对比

所用Schema

Avro所用Schema

{"namespace": "test.avro",
 "type": "record",
 "name": "User",
 "fields": [
     {"name": "i", "type": ["int","null"]},
     {"name": "l",  "type": ["long", "null"]},
     {"name": "s", "type": ["string", "null"]},
     {"name":"b","type":["boolean","null"]}
 ]
}

Protobuf所用Schema

message SomeData {
optional int32 i = 1;
optional int64 l = 2;
optional string s = 3;
optional bool b=4;

}

写出的数据:

{
    "i" : random,
    "l" : random,
    "s" : "never",
    "b" : random
}

测试对象:

  1. protoc</
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值