Project testing serialization and deserialization time for exactly same data structure using Google Protocol Buffers, YAML, JSON, XML, Apache Avro, MessagePack and default for Python - Pickle.
docker build -t pickle_tst:1.0 ./pickle
docker build -t json_tst:1.0 ./json
docker build -t proto_tst:1.0 ./proto
docker build -t xml_tst:1.0 ./xml
docker build -t avro_tst:1.0 ./avro
docker build -t mpk_tst:1.0 ./mpk
docker build -t yaml_tst:1.0 ./yaml docker compose up -d| Format | UDP Port |
|---|---|
| Pickle | 2001 |
| JSON | 2002 |
| Google Protocol Buffers | 2003 |
| XML | 2004 |
| Apache Avro | 2005 |
| MessagePack | 2006 |
| YAML | 2007 |
In less than a minute you will receive answer in format
{format} - {serialized structure file size in bytes} - {time of serialization in ms} - {time of deserialization in ms}
Example of the request
echo -n "get_result" | nc -4u localhost 2001Example of the response
Pickle - 6842 - 99ms - 45msTesting data structure contains several types
Data = dict(root=dict(int_1=2 ** 9, float_1=3.14, str_1="short string",
str_2="I AM LONG STRING, VERY VERY LONG!!!!!!!!!!!!!!!!!!!!",
lst_int=[i ** 2 for i in range(1000)],
lst_str=[str(i) * 10 for i in range(100)]))