what's faster on iPhone? XML pList or JSON?

荒凉一梦 提交于 2019-12-10 02:09:39

问题


Assuming both XML plist and JSON are delivered over http, gzipped, which one will be processed faster on an iPhone?


回答1:


A co-worker and I did some rudimentary benchmarks recently to test which was faster for an application we were writing. We tested this JSON framework, and the NSXML parser as well as a TreeNode parser we found in an Objective-C book. Here is the note I sent to the other developers on our team:

The benchmark tested how each library handled getting the filename and path
of 100 assets, 100 times each (for a total count of 10,000 runs per library).
The results are below:

Method    Average(s)    Total(s)
TreeNode  0.307475      30.747493
NSXML     0.483778      48.377843
JSON      0.233179      23.317870 



回答2:


JSON beats plists according to this: http://samsoff.es/posts/web-services-with-cocoa-surprise




回答3:


It depends on the data that is delivered and the way it is parsed, but they should both be similar in speed. You should just choose the one that is easier for you to develop a parser and then fine tune the parser.




回答4:


In the "Building a Server-Driven User Experience" session of WwDC, an Apple developer stated that PLIST was preferred for being faster and easier to use.



来源:https://stackoverflow.com/questions/3518215/whats-faster-on-iphone-xml-plist-or-json

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!