Categories
android

Benchmarking Protobuf vs JSON parsing in Android

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.

Categories
android

SMS Bot Widget V1.3 in the Market

I have just uploaded SMS Bot Widget V1.3 to the Android Market. It includes the same new backgrounds as my Reader Widgets and a quick contact button in the send dialogue for Android 2.0+ phones:

quick contact

Full changelog:

  • Choose from new black or white widget backgrounds
  • Quick contact button with photograph for Android 2.0+ phones. Phones running Android 1.x will still see the quick call button
Categories
android

Reader Widgets V2.6 in the Market

I have just uploaded version 2.6 of the Reader Widgets Pro and Free to the Market. I have included new functionality to choose the whether the widget background is black or white:

colours

The old white background has been ditched as it looked dated. Full change log for this release:

  • Option to select from either black or white widget backgrounds
  • Bug fix: duplicate tags in medium widget or tag list. This was introduced in V2.5
  • Bug fix: force close error in a situation when there is no network connection and a new authorization token is needed
  • Bug fix: gzip response now elicited from Google Reader API for fetching subscriptions list. This should speed up the configuration screen.
Categories
android

Reader Widgets V2.5 in the Market

I have just uploaded V2.5 of Reader Widgets Pro and Free to the Android Market. This update contains a quick fix for some changes that Google made to authorization for all of their APIs. The authorization tokens used to access the API now get invalidated by Google every night. The widgets were unable to handle this. Symptoms were: outdated information being displayed in the widgets and the webview showing a login page. This only started happening in the last couple of days.

To handle this situation the widgets now obtain a fresh token from Android (automatic login users) or the Google Client Login API (manual login users) if they get an “unauthorized” response from the Google Reader API. This happens in the background so no user interaction is required. This fix should also make the widgets more robust in general.