开发者

performance of nspropertylistserialization vs nsjsonserialization

I'm considering making a switch from serializing data from my web servi开发者_如何转开发ce endpoint as JSON to a binary property list. I'm unserializing on Cocoa. Has anyone who has used both NSPropertyListSerialization and NSJSONSerialization noticed a difference in parsing times? I'm curious as I've read before that there's a noticeable difference—see this blog post (in the Under the Hood section) for an example by Hipmunk.

Also interesting to me if there's a noticeable difference between NSJSONSerialization and external libraries like JSONKit or TouchJSON.


I pulled down 200 tweets and profiled parsing the payload using both SBJSON and NSJSONSerialization. The results:

SBJSON: 489ms / 397KB NSJSONSerialization : 133ms / 3.8 KB

NSJSONSerialization has a pretty significant advantage - especially in terms of the memory footprint.

http://blog.skulptstudio.com/nsjsonserialization-vs-sbjson-performance


I can say that NSJSONSerialization is faster than JSONKit, I used it for a Core Graphics project and code which took on average 26ms before is now 16ms, with only changes in the JSON deserialization.

Not sure on NSPropertyListSerialization, but the GitHub page of JSONKit claims it's faster than binary .plist, which leads me to believe that NSJSONSerialization class is the fastest of them all. Correct me if I'm wrong.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜