4 ms·
YAML & XML serialize / deserialize is slower than its JSON equivalent. On top of that schema assisted JSON serialization can be almost as fast as something lik
by mahyarm 10y ago
YAML & XML serialize / deserialize is slower than its JSON equivalent.
On top of that schema assisted JSON serialization can be almost as fast as something like protobuf, but you don't have to deal with binary or a lot of codegen on both sides.
- RangerScience 10y agoWhy? Is that a consequence of the specification, or an artifact of the implementations? Or, as in the case of XML, a consequence of common usage? PS - I'm not counting the inherent different from simply more characters as important: <obj> <string>foo</string> <obj> obj: string: foo { "obj": { "string":"foo"} } That's not important. If you have enough extra characters for that to be important, you have enough data that you should probably do something other than serialize to text.
- mahyarm 10y agoXML is significantly more complicated and creates a tree structure that doesn't map 1:1 to common programming strings, arrays, dictionaries and numbers. It creates nodes with attributes in a tree structure with namespaces and whole bunch more. The consumer parsing code is significantly more complicated too. YAML is missing things such as quote marks so you have to do things such as type inference to determine what an item is, which decreases speed. I don't know the specifics more than that, but just do serialization benchmarks and you'll see it pretty quickly.