I have a bit of an addiction to benchmarking. It must be because I’m a PC gamer (yes we still exist). Actually it’s probably more of an addiction to tweaking every last ounce of performance out of something. Recently I learned how to get to the protocol buffers version of the Google Reader API. Protocol buffers is a Google’s own binary message format that they open sourced a while ago. The messages have no field information in them so they are potentially smaller and faster to download and parse than JSON. After some guess work to parse the messages properly I set up my G1 (Android 1.6) to alternately download JSON and protocol buffers versions of the unread counts list of my Google Reader account on Wifi. It turns out that as long as jackson is used to parse the JSON there is hardly any difference. Protocol buffers took an average of 127 milliseconds to download and parse an unread count (there is one count for every feed or tag with unread items in Reader). JSON took 133 milliseconds. I think this is because JSON responses are gzipped so they are fairly compact anyway and also jackson is screamingly fast as a parser. As protocol buffers messages are binary there is no need for the Reader API to gzip them (although some fields in them are plain text strings). I used the “Lite” version of the protocol buffers jar file which is supposed to better for mobile devices.
For now I don’t think its worth the risk to migrate to protocol buffers. These benchmarks aren’t comparable to my previous ones which hit a different part of the Google Reader API. I might revisit downloading headlines with protocol buffers at a later date. The larger size of the headlines responses might show more of a performance difference between to the two message types.