Fast JSON parser for iOS(blog.nextive.com)
blog.nextive.com
Fast JSON parser for iOS
http://blog.nextive.com/392-nextive-json-parser-for-ios-and-mac-os-%E2%80%93-fast/
9 comments
It looks like he ran Sam Soffes' json-benchmark: https://github.com/samsoffes/json-benchmarks
That being said here are the results I got on my iPhone 4 (compiled with -Os) Reading: http://yfrog.com/khul0wsj Writing: http://yfrog.com/h0nqgzej
That being said here are the results I got on my iPhone 4 (compiled with -Os) Reading: http://yfrog.com/khul0wsj Writing: http://yfrog.com/h0nqgzej
Interesting, but several of the questions I posed remain, some of I suspect which will explain the significant differences between your measurements and theirs. Except for one: NXJson is exponentially slower at reading for you than they claim it is for them, which may be hard to explain away...
haberman's rule for publishing benchmarks: you don't get to claim that you're >2x faster than your already-highly-optimized competitor without explaining why. If you don't know why, you need to figure out why. Without explaining why, I will assume that it's not an apples-to-apples comparison, or that you made a mistake in your benchmarking.
Not quite. See these tweets from the author of TouchJSON (Spoiler: JSONKit is still faster, TouchJSON still has a better interface):
http://twitter.com/#!/schwa/status/94835100075819008 http://twitter.com/#!/schwa/status/94840915075674112
http://twitter.com/#!/schwa/status/94835100075819008 http://twitter.com/#!/schwa/status/94840915075674112
It's not even plausible. Native binary plist reading is typically about 2x as fast as JSONKit (in my informal benchmarks).
So they claim to be about an order of magnitude faster than binary plists, which would be astonishing if it were true.
So they claim to be about an order of magnitude faster than binary plists, which would be astonishing if it were true.
Somewhat off-topic, but looking at the readme of JSONKit [1] I found: "At this time, there are no plans to support ARC in JSONKit. Although tenative [sic], it is extremely unlikely that ARC will ever be supported, for many of the same reasons that Mac OS X Garbage Collection is not supported."
Which seems kind of weird, seeing as ARC is going to be the default pretty soon.
[1] https://github.com/johnezang/JSONKit
Which seems kind of weird, seeing as ARC is going to be the default pretty soon.
[1] https://github.com/johnezang/JSONKit
Not that this matters, though, because ARC and non-ARC code can call each other.
Have you ever looked at the code in JSONKit? It makes perfect sense that it won't support ARC. JSONKit has a lot of small optimizations that deal with allocating memory that interfere with ARC and the assumptions the compiler needs to be able to make for ARC to work.
Anyone benched this against a binary protocol like thrift or protocol buffers?
If JSON parsing is a bottleneck in your application, you're doing it wrong.
Additionally, they should also run the parser on a few passes prior to starting benchmarking to "warm it up". This reduces variance in the runs, especially via things like initialization/memory allocation in the first run.
Without most (or all!) of that kind of information, one can't make a reasonable judgement.