Click to enlarge...<\/figcaption><\/figure>\nThe first, small dataset yielded mildly interesting results. The data makes it pretty clear that SimpleXML takes less memory at compile and execution time and during the life of the script. It also responds just as fast as the JSON.<\/p>\n
However, in the large dataset, the results are a bit more intriguing. The JSON version is using more memory at the start of execution, but once the script is done, it consumes the least memory over time. As one might guess, the pure SimpleXML parsing consumes a noticeably larger amount of memory during its lifetime. The pure PHP XML functions perform well, but as a whole they just aren’t as good as the native JSON parsing.<\/p>\n
And then there’s the execution time on the larger dataset…wow! The pure PHP XML functions are just atrocious in comparison to the other two methods. SimpleXML, while consuming 42% more memory, took twice as long as the JSON.<\/p>\n
Ultimately, we decided that PHP’s native JSON parsing was the best fit. We had several debates about the various permutations of these scenarios and dataset sizes. That is, with really small datasets, SimpleXML is the obvious tool of choice. We also did some analogous Perl testing to see how the other end of the system would perform. The results were conclusively in favor of JSON (we predominantly use JSON::XS nowadays). So, in the end, we came to the consensus that datasets tend to be larger rather than smaller and that execution time is the hardest resource to compromise. This makes JSON the best all around solution for LivePHP.<\/p>\n","protected":false},"excerpt":{"rendered":"
A while back, Matt Dees blogged about our upcoming change to LivePHP in 11.28. Specifically, he mentions the use of JSON. In this article I will illustrate, in brief, why this change was made. The decision process, as you’ll see, wasn’t exactly straight forward, but a solid compromise.<\/p>\n","protected":false},"author":77,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[49],"tags":[],"class_list":["post-74","post","type-post","status-publish","format-standard","hentry","category-products"],"acf":[],"yoast_head":"\n
JSON vs. XML in LivePHP | cPanel<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n