Binary serialization vs JSON vs xml

Does anyone know what is approximately related to the performance gain in terms of time when using binary serialization compared to JSON compared to xml and sending data over the network, provided that there are many small (string) fields in the data structures?

To what extent is the serializer responsible for performance? What about a programming language?

An ideal landscape is one in which we ignore portability problems, and suppose we have the libraries needed to serialize / deserialize to and from all three formats.

+6
source share
1 answer

It is impossible to answer your question adequately, because it depends on your specific requirements and needs.

To some extent, you can tell this amount of data used to describe the serialized representation, which affects performance.

For example, an XML document requires opening and closing tags, such as ..., while JSON is enough for prop1: "...", which reduces the amount of character data needed to describe the instance. A binary file may even skip naming a property, which then further reduces the amount of data needed to describe the serialized instance.

Although this may result in binary image serialization being the fastest, this is not always the case. It depends on how long the serializer should get from the object instance in the serialized description.

If you really need performance, you should take a look at the google protocol buffers. In my experience, they are lightning fast and fairly easy to use.

+3
source

All Articles