Sam Soffes

Updated iPhone JSON Benchmarks

Posted in benchmarks, cocoa, development, iphone, and json

I wrote a post awhile ago about JSON benchmarks. I was telling a friend he should use JSON Framework based on my old benchmark post. He asked if I had run them again recently, so I figured I'd run them again.

I updated my test app and added a new library called YAJL based on a C library. My results were very similar to before. This time I tested it on an iPad and iPod Touch.

16GB 1st Gen iPad running iOS 3.2

8GB 3rd Gen iPod Touch running iOS 3.1.3

Results

On both devices, they ranked Apple JSON, YAJL, JSON Framework, and TouchJSON. You can read the detailed results on GitHub.

In conclusion, it looks like YAJL is the new one to use. Again, feel free to check out my code on GitHub.

iPhone JSON Benchmarks

Posted in benchmarks, cocoa, development, iphone, and json

Yesterday I wrote a post on parsing JSON with Apple's private framework. I thought it might be worth benchmarking TouchJSON, JSON Framework, and Apple JSON (what I'm calling the private framework). My results were very interesting.

JSON Benchmarks

I know I posted awhile ago that TouchJSON was really fast, but I guess I got my numbers mixed up. This time I ran each test 100 times and took the average. These are the numbers from TouchJSON 1.0.6 and JSON Framework 2.2.2 running on my iPhone 3GS compiled for iPhone OS 3.1. You can get the code on GitHub and see for yourself.

In conclusion, it looks like JSON Framework is the one to use, since you probably shouldn't use Apple JSON in a shipping app. JSON Framework was always my favorite for the clean, category-style interface. I only tested Apple JSON to see how the other implementations compared to it.

Parsing JSON with the iPhone's Private JSON Framework

Posted in cocoa, development, iphone, and json

So my post on Cocoa web services got a lot of attention when Gruber linked me the other day. This started a conversation on Twitter and basically ended up landing on using binary property lists over JSON for size and parsing, but that's for another blog post.

All of this got me thinking about how Apple does their JSON parsing, since they are obviously using JSON in several of the built in apps. I happened to notice that there was a JSON.framework in the Private Frameworks folder this evening. I tried class-dumping it and it surprising worked! (Most of the other private frameworks I tried to class-dump didn't produce any results.)

I figured what the heck, might as well try it. It turns out that it was really easy to implement. I posted a sample project demonstrating this on GitHub.

It really sucks that this is private. It works really well. I wish Apple would open this up. I know a lot of people would benefit from it. I've heard that if you link against any private frameworks in your app, it will automatically get rejected. I haven't been brave enough to test this yet.

Anyway, it's kinda a cool discovery. Check out my sample project on GitHub.