Media, Technology, National Security, and more.

Sunday, July 04, 2010

JVM Serializers for Android - Part 1

I've been thinking a lot about Android <==> Server communications lately.  Well actually for a long time now.  The issues that I care about, of course are:

  1. Message Size
  2. Size of Library
  3. Memory usage
  4. Overall speed
  5. Compression Speed
  6. Decompression speed
  7. Ease of Integration

I started thinking I was going to use XML, but I hate XML. Then I thought I'd use some kind of simple JSON, and I found the JSON Schema which actually has a draft RFC and tools.  I actually wrote quite a bit of code around JSON. Then I remembered Google's Protocol Buffers, which has versioning as a feature, and produces very small messages.

Fortunatly, I'm not alone on my quest, I found Serializing Data - JSON vs. Protocol Buffers, I was planning to just rerun his tests on Froyo, review his code, and be done with it.  (Froyo has a different 'faster' Dalvik VM, and is suposed to have much better JSON parsing.) But no, I found JVM-Serializer Benchmarks,  it has lots of great data, but is still missing one of my key data points, how much memory does it use.  The benchmarks have unfortunately pointed me to two additional projects Kryo and ProtoStuff.

Kryo seems to be the overall winner, but it doesn't really support versioning.  That's probably ok for my needs, but I need to really think about that as there may be somewhere an issue.  The other question is with the faster JSON implementation, and it being in the ROM, do I wish to pay the cost for an additional library.

It's now time for the beach, so I'll write more on this tonight or tomorrow.  For that I'll have modified the android test program to add in Kryo, and possibly ProtoStuff.

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



<< Home