More JSON than you can shake a stick at
Tags
- Performance
- Content Pipeline
Historically I have used jsoncpp as it was easy to integrate and the API was very C++, however, on profiling it always seemed to allocate a lot more memory that I would have suspected. Working on enscriptem I switched to jansson as it performed better than jsoncpp and the javascript parser would use the native browser parsing making enscriptem results even better.
When considering pulling the enscriptem changes to mainline I felt honor bound to do the right thing and profile any likely candidate. I found an already existing benchmark, adapted for iOS and switched the test data to actual game data. Of the 8 JSON parsers tested (cjson, jansson, jsoncpp, libjson, rapidjson, sajson, vjson and yagl) over half made less than 5 allocations, regardless, vs thousands or ten thousand in the libjson case. Performance scaled with memory.
However, some, vjson, sajson, yagl are read-only structures. Our two likely candidates are cjson and rapidjson.