Ticket #41: use bytearray() instead of StringIO.

CPython 2.7, before:
    10 loops, best of 6: 38.8 msec per loop

After:
    10 loops, best of 6: 31.5 msec per loop