Protobuf vs Json — Performance test Serialization and Deserialization

Carly Christian
2 min readMar 14, 2021

--

Protobuf vs Json — Performance test Serialization and Deserialization

Hi, this is the second article of serie gRPC. In this article we can to see the performance test betewen Protobuf vs Json, so lets go.

In the tests, we simulated the serialization and deserialization of 1 million objects by repeating this process 5 times and at each of these intersections, we took the execution time. Below we see the result for Protobuf (proto) and Json.

The repository with the performance test is here in github.

Protobuf performed better than Json 4 to 5 times faster on average in tests. We use what the market generally uses as lombok and ObjectMapper. The tests do not bring scientific evidence or academic precision, but it is possible and plausible that as proof of concept and given the results and numbers, the greater margin of error / accuracy of the tests does not interfere with the result that is clear. In terms of performance to serialize and deserialize, Protobuf is much superior to Rest.

Next articles of the series:
Project setup for Protobuf
Example a simple message.
Basic about archive .proto
Types-Protobuf
Java interface in Protobuf
Collection in Protobuf
Map in Protobuf
Enum in Protobuf
What is a tag in Protobuf
Basic versioning in Protobuf

Thanks a lot and see you in the next article.

Vamos dividir conhecimento, pois quando dividimos, estamos multiplicando.

--

--

Carly Christian

Oi, eu sou o carly. Gosto de falar sobre varios assuntos e visões que tenho sobre o mundo, é isto.