3 ms·
Parsing was never the bottleneck, I admit. But I can't see how parsing XML is as easy a task as parsing JSON either? Of course you can show me some benchmarks
by untitaker_ 11y ago
Parsing was never the bottleneck, I admit. But I can't see how parsing XML is as easy a task as parsing JSON either?
Of course you can show me some benchmarks that show that libxml2 is much faster than the avg. JSON implementation. But you can do that with any format that is verbose, complex and therefore hard to parse, yet has been around for so long that it paid off to write well-optimized C libraries for it.
- Tharkun 11y agoExactly. You can point to benchmarks that favour one or the other. Parsing is almost never the bottleneck.
- untitaker_ 11y agoThe point I'm trying to make is that JSON is generally easier to parse, therefore theoretically faster to parse, even though XML implementations might be faster at the moment.
- tveita 11y agoA theoretical microsecond difference that doesn't even exist in practice doesn't seem worth mentioning when there is network traffic involved. The article says: "Yes, it's slow to fetch all events, but so is parsing XML. " That's several orders of magnitude difference glossed over.
- anentropic 11y agoof course, being verbose, XML will be slower to fetch across the network as well
- untitaker_ 11y agoMeh, I have to agree that it isn't a good point. I guess I was merely trying to point out that both have its performance deficiencies. At least the ones of remoteStorage are avoidable, while you can't just avoid XML in WebDAV.
- mikekchar 11y agoI recommend that you simply write a JSON parser and an XML parser using a parser generator. Then you will see. They are both trivial. I would be surprised if it took you more than an afternoon to do both. Ease of parsing was the whole point of XML. It was actually a beautiful concept that because it was a subset of SGML, you could validate documents and build smart editors, etc, etc on file formats in XML. Then when you wanted to simply read the file, the parser was mind blowingly simple to write. Of course people decided that it would be great for communications protocols, and inter-language object representations and... all the stuff that it really wasn't great for. And people decided that you would want to write event driven parsers and do DOM traversals and crazy things like that. Yeah, that stuff is complicated. (and dare I offend people by saying that it wasn't really a good idea after all). But parsing is dead easy. Personally prefer JSON for most things because it is easier to type :-)
- untitaker_ 11y agoI said "easy parsing", not "easy implementation". "Computationally cheap" is probably a better term. Everything is trivial with a parser generator. This is besides the point.