Binary serialization vs. JSON vs. xml [closed]
Asked Answered
M

1

10

Does anyone know what are approximately the performance gains, in terms of time, when using binary serialization versus JSON versus xml and sending the data over the network, provided that the data structures have a lot of small (string) fields?

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

The perfect scenery is the one in which we ignore the portability problems and we assume we have at disposal the libraries needed for serializing/deserializing to and from all 3 formats.

Megass answered 13/11, 2012 at 13:52 Comment(4)
The best way to find out? Test it for yourself. Whatever someone answers here will be based on their requirements and needs which may not suit your own.Neuroblast
It depends on so many things, your question is unanswerable, other than to say: in most cases, serialization format is not performance bottleneck.Anneliese
Then what would you say are the biggest performance bottlenecks?Megass
Yup impossible question to answer...Avoiding performance issues, the following answer deals with the "why" use alternative formats like XML + JSON: #10368843Closet
P
7

It's kind of impossible to answer your question adequately, because it depends on your specific requirements and needs.

To some extend you could say it's the amount of data used to describe the serialized representation, which influences the performance.

For example, a XML document would need opening and closing tags like ..., while JSON would suffice with prop1:"...", which reduces the amount of character data needed to describe the instance. Binary might even skip the property naming, which then further reduces the amount of data needed to describe the serialized instance.

Although this might paint the picture binary serialization would be the fastest, it isn't always the case. It depends on how much time the serializer needs to get from an object instance to the serialized description.

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

Prase answered 14/11, 2012 at 7:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.