[Python-Dev] Performance of various marshallers

Skip Montanaro skip@pobox.com (Skip Montanaro)
Mon, 1 Oct 2001 20:45:10 -0500


I just tested each of the marshallers readily available to me.  I dumped and
loaded this object:

    ['MusicEntry',
     'email': 'foo@bar.baz.spam',
     'time': '7:30pm',
     'tickets': '',
     'program': '',
     'state': 'MA',
     'start': '2002-01-26',
     'venueurl': '',
     'country': '',
     'performers': ['An Evening with Karen Savoca'],
     'addressid': 7283,
     'name': '',
     'zip': '',
     'city': 'Sudbury',
     'info': 'Reservations required. Please call (978)443-3253 or e-mail Laurie at lalcorn@ultranet.com.',
     'merchandise': [],
     'event': '',
     'keywords': ['.zyx.41'],
     'submit_time': '2001-08-28',
     'key': 325629,
     'active': 1,
     'end': '2002-01-26',
     'address1': '',
     'venue': 'Fox Run House Concerts',
     'price': '$17',
     'address3': '',
     'address2': '',
     'update_time': '2001-09-22:19:28:44'}]

I don't claim this is typical data, but it is typical of the type of data I
push through XML-RPC, so it's important to me.  You can see why moving
imports out of dump_string was so worthwhile.  I would be happy to change
the object being marshalled to better reflect what people think is
"typical".

All numbers in the following table are in encodings or decodings per second.
All times were measured using time.clock.  The number of times the
encoding/decoding operation was performed was varied to give a reasonable
total test time (approximately 5 seconds).  Each test was run 3 times.  The
largest number is recorded below, rounded to three significant digits.

                        encode          decode
                        ------          ------
    marshal             25900           7830
    cPickle              1230            149
    xmlrpclib 0.9.8
        w/ sgmlop         416            107
        w/o sgmlop        415             16.3
    xmlrpclib 1.0b4
        w/ sgmlop         365             92.0
        w/o sgmlop        363             74.9
    py-xmlrpc            2780           2260

Skip