XML Found To Be Just As Fast As JSON


Share this Post

Since its introduction in 1996, XML has taken the world by storm by providing an easy to use markup language that's used in everything from RSS to office productivity software. Its main competitor - JSON - is often quoted as being superior due to it being faster while using less bandwidth. One engineer has set to prove that wrong.

David Lee, lead engineer at MarkLogic, has published a paper called "Fat Markup: Trimming the Myth One Calorie At A Time." The paper documents an experiment where he pit XML against JSON in almost 1,200 tests covering 33 different documents across multiple Web browsers and operating systems. The results may surprise you.

Upon the conclusion of the experiment, Lee had found four areas that show XML and JSON are both slaves to outside influences. The first conclusion found that the parsing speed changes depending on which parsing technique is used with XML performing better with pure JavaScript while JSON performs betters with query speed. The second conclusion found that jQuery slows down both markup languages, but XML sees a bigger dip in performance. The third conclusion found that compressed documents, regardless of format, are the same size across both markup languages. The final conclusion found that transfer speed is largely the same across both markup languages.

So, what does this all mean? The needless fighting over which markup language is better doesn't make the Web a better place. Lee instead recommends that developers focus on making their Web sites more efficient so that both XML and JSON can perform at their best. To that end, he recommends the use of HTTP Compression and markup optimization. He does provide one caveat though. Developers shouldn't try to optimize unless there's a significant problem with data transmission on their Web site.

[Image: Dreftymac/WikiMediaCommons] [h/t: InfoQ]