Benchmark

I’ve performed a little benchmark comparing the performances of Cerealizer, cPickle, Jelly + Banana and Jelly + cBanana (from Twisted Matrix) for serializing a list of 2000 objects defined as following :

class O:
  def __init__(self):
    self.x = 1
    self.s = "jiba"
    self.o = None

with self.o referring another 0 object in the list.

The results are (with Psyco) :

With old-style classes:
    cerealizer
    dumps in 0.0619530677795 s, 114914 bytes length
    loads in 0.0313038825989 s


    cPickle
    dumps in 0.0301840305328 s, 116356 bytes length
    loads in 0.023097038269 s


    jelly + banana
    dumps in 0.168012142181 s 169729 bytes length
    loads in 1.82081913948 s


    jelly + cBanana
    dumps in 0.082946062088 s 169729 bytes length
    loads in 0.156159877777 s


With new-style classes:
    cerealizer
    dumps in 0.0575239658356 s, 114914 bytes length
    loads in 0.028165102005 s


    cPickle
    dumps in 0.07634806633 s, 116428 bytes length
    loads in 0.0278959274292 s


    jelly + banana
    dumps in 0.156242132187 s 169729 bytes length
    (TypeError; I didn't investigate this problem yet although it is surely solvable)


    jelly + cBanana
    dumps in 0.10772895813 s 169729 bytes length
    (TypeError; I didn't investigate this problem yet although it is surely solvable)

feature pickle cPickle Cerealizer Jelly + Banana Jelly + cBanana Language Python C Python Python Python + C Speed Very slow Very fast Fast; can even beat cPickle on new-style classes Very slow Slow Secure No Yes Yes File length Medium Medium, roughly equivalent to pickle Medium, files seem slighly more bigger on my bench Human-readability of files Poor Very poor Good Supports C-defined types Yes Yes Yes, although see (*)

(*) Jelly handles them, but tuples and objects in a cycle are first created as _Tuple or _Dereference objects; this works for Python classes, but not with C-defined types which expects a precise type (e.g. tuple and not _Tuple), due to static typing.