kevboh
kevboh

Reputation: 5245

performance of nspropertylistserialization vs nsjsonserialization

I'm considering making a switch from serializing data from my web service 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.

Upvotes: 1

Views: 1835

Answers (2)

Ralph Marczynski
Ralph Marczynski

Reputation: 193

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

Upvotes: 2

Henri Normak
Henri Normak

Reputation: 4725

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.

Upvotes: 1

Related Questions