{
  "$type": "site.standard.document",
  "description": "A few months ago I wrote a post about JSON parsing libraries for Cocoa. I compared 4 libraries – BSJSONAdditions, JSON Framework, TouchJSON, and YAJL, I ran a benchmark on all of them, and the conclusion was that YAJL was the fastest and BSJSONAdditions was way slower than the rest.\n\nLast week John Engelhart commented on that post, mentioning his own JSON library JSONKit, claiming that it’s really fast. Of course I had to check if that was true :)\nI couldn’t just run the same test now on latest JSONKit and compare the result against the old results, that wouldn’t be very fair – so I checked the repositories of the other projects, downloaded latest versions and rerun all the tests.\n\nHere are the results (I took a median value from 5 runs for every library):\n\nSimulator\n\n  \n    Framework\n    time [s]\n  \n  \n    BSJSONAdditions\n    0.184697\n  \n  \n    TouchJSON\n    0.037910\n  \n  \n    YAJL\n    0.016679\n  \n  \n    JSON Framework\n    0.015583\n  \n  \n    JSONKit\n    0.012852\n  \n\nDevice\n\n  \n    Framework\n    time [s]\n  \n  \n    BSJSONAdditions\n    10.526504\n  \n  \n    TouchJSON\n    2.323277\n  \n  \n    YAJL\n    1.021358\n  \n  \n    JSON Framework\n    0.907641\n  \n  \n    JSONKit\n    0.587229\n  \n\nConclusions:\n\nFor BSJSONAdditions, TouchJSON and YAJL the results are very similar to what I got last time.\nBSJSONAdditions, which I used before and to which I even contributed some patches, is still slow as hell. The project was last updated in 2009, which means it’s basically dead. Don’t use it.\nTouchJSON and YAJL are still maintained (TouchJSON has moved from Google Code to GitHub); however, that didn’t make them any faster than before.\nJSON Framework has also moved to GitHub, and it seems the author has made a lot of progress on it: it’s now more or less 3× faster than before, which makes it slightly faster than YAJL, the previous winner.\nBut the biggest surprise was JSONKit – it seems John was right, it really is super fast. It’s about 50% faster than YAJL and JSON Framework, and 20× faster than BSJSONAdditions. It’s also the easiest to install - it’s just two files, no frameworks, no subdirectories, no need to change anything in Xcode project settings.\n\nSo if you’re looking for a fast JSON library for your iPhone app, choose JSONKit.\n\nAgain, the test project is here (430 KB).\n\nUpdate: John Engelhart told me that my JSON is a kind of worst case scenario, in that it contains mostly randomized data. In real data there should be much more repeating keys and values, which can be cached by JSONKit, and in such cases it should be even faster than here. Go figure…",
  "path": "/2010/12/12/cocoa-json-parsing-libraries-part-2/",
  "publishedAt": "2010-12-12T21:51:13Z",
  "site": "at://did:plc:oio4hkxaop4ao4wz2pp3f4cr/site.standard.publication/3mn5mackuba26",
  "tags": [
    "Cocoa",
    "iPhone"
  ],
  "textContent": "A few months ago I wrote a post about JSON parsing libraries for Cocoa. I compared 4 libraries – BSJSONAdditions, JSON Framework, TouchJSON, and YAJL, I ran a benchmark on all of them, and the conclusion was that YAJL was the fastest and BSJSONAdditions was way slower than the rest.\n\nLast week John Engelhart commented on that post, mentioning his own JSON library JSONKit, claiming that it’s really fast. Of course I had to check if that was true :)\nI couldn’t just run the same test now on latest JSONKit and compare the result against the old results, that wouldn’t be very fair – so I checked the repositories of the other projects, downloaded latest versions and rerun all the tests.\n\nHere are the results (I took a median value from 5 runs for every library):\n\nSimulator\n\n  \n    Framework\n    time [s]\n  \n  \n    BSJSONAdditions\n    0.184697\n  \n  \n    TouchJSON\n    0.037910\n  \n  \n    YAJL\n    0.016679\n  \n  \n    JSON Framework\n    0.015583\n  \n  \n    JSONKit\n    0.012852\n  \n\nDevice\n\n  \n    Framework\n    time [s]\n  \n  \n    BSJSONAdditions\n    10.526504\n  \n  \n    TouchJSON\n    2.323277\n  \n  \n    YAJL\n    1.021358\n  \n  \n    JSON Framework\n    0.907641\n  \n  \n    JSONKit\n    0.587229\n  \n\nConclusions:\n\nFor BSJSONAdditions, TouchJSON and YAJL the results are very similar to what I got last time.\nBSJSONAdditions, which I used before and to which I even contributed some patches, is still slow as hell. The project was last updated in 2009, which means it’s basically dead. Don’t use it.\nTouchJSON and YAJL are still maintained (TouchJSON has moved from Google Code to GitHub); however, that didn’t make them any faster than before.\nJSON Framework has also moved to GitHub, and it seems the author has made a lot of progress on it: it’s now more or less 3× faster than before, which makes it slightly faster than YAJL, the previous winner.\nBut the biggest surprise was JSONKit – it seems John was right, it really is super fast. It’s about 50% faster than YAJL and JSON Framework, and 20× faster than BSJSONAdditions. It’s also the easiest to install - it’s just two files, no frameworks, no subdirectories, no need to change anything in Xcode project settings.\n\nSo if you’re looking for a fast JSON library for your iPhone app, choose JSONKit.\n\nAgain, the test project is here (430 KB).\n\nUpdate: John Engelhart told me that my JSON is a kind of worst case scenario, in that it contains mostly randomized data. In real data there should be much more repeating keys and values, which can be cached by JSONKit, and in such cases it should be even faster than here. Go figure…",
  "title": "Cocoa JSON parsing libraries, part 2",
  "updatedAt": "2025-06-30T01:49:16Z"
}