Home

Awesome

Protobuf Benchmarks by Zserio


Protobuf Benchmarks by Zserio is an independent benchmark which uses zserio-benchmarks-datasets to compare Google's Protocol Buffers performance to Zserio on the same sets of data.

Zserio vs. Protocol Buffers

Google's Protocol Buffers are very popular and in wide-spread use. One of the many questions we always have to answer is: "Why don't you use Protobuf? It is already there."

Fact is that it wasn't open sourced when we would have needed it. Maybe we would have used it back then. But even today we think we came along with something more tailored to our needs. This is also the reason why we open sourced Zserio after such a long time.

So let's see how Zserio performs in comparison to Protobuf. For being fair we have chosen as well the example that is used on Google's documentation page of Protobuf (addressbook). This example does not really help to promote a binary - thus smaller - representation of data. It mostly uses strings.

Running

Make sure you have the following pre-requisites installed:

Also do not forget to fetch the datasets with git submodule update --init.

Now you are ready to run the benchmark.sh script which accepts the required platform as a parameter (e.g. cpp-linux64-gcc):

scripts/benchmark.sh <PLATFORM>

The script benchmark.sh automatically generates simple performance test for each benchmark. The performance test uses generated Protocol Buffers' API to read appropriate dataset from JSON format, serialize it into the Protocol Buffers' binary format and then read it again. Both reading time and the BLOB size are reported. BLOB size after zip compression is reported as well.

Results

Protobuf 3.21.12

BenchmarkDatasetTargetTimeBlob SizeZip Size
addressbook.protoaddressbook.jsonC++ (linux64-gcc)1.731ms356.292kB193kB
apollo.protoapollo.proto.jsonC++ (linux64-gcc)0.641ms286.863kB136kB
carsales.protocarsales.jsonC++ (linux64-gcc)2.053ms399.779kB242kB
simpletrace.protoprague-groebenzell.jsonC++ (linux64-gcc)0.386ms113.152kB54kB

Zserio 2.10

BenchmarkDatasetTargetTimeBlob SizeZip Size
addressbook.zsaddressbook.jsonC++ (linux64-gcc)1.478ms305.838kB222kB
addressbook_align.zsaddressbook.jsonC++ (linux64-gcc)0.844ms311.424kB177kB
apollo.zsapollo.zs.jsonC++ (linux64-gcc)0.244ms226.507kB144kB
carsales.zscarsales.jsonC++ (linux64-gcc)1.374ms280.340kB259kB
carsales_align.zscarsales.jsonC++ (linux64-gcc)0.925ms295.965kB205kB
simpletrace.zsprague-groebenzell.jsonC++ (linux64-gcc)0.221ms87.042kB66kB

Time Comparison

time comparison

Size Comparison

size comparison

Why Is Zserio More Compact Than Protobuf?

To be fair, it is necessary to note that Protobuf encodes more information which are used for compatibility of encoder/decoder when proto file is changed:

On another hand, zserio encoder uses better compactness:

How to Add New Benchmark