[Python-Dev] Cloning threading.py using proccesses
Simon Wittber
simonwittber at gmail.com
Thu Oct 12 02:31:19 CEST 2006
On 10/12/06, Josiah Carlson <jcarlson at uci.edu> wrote:
>
> It would basically be something along the lines of cPickle, but would
> only support the basic types of: int, long, float, str, unicode, tuple,
> list, dictionary.
>
Great idea! Check this thread for past efforts:
http://mail.python.org/pipermail/python-dev/2005-June/054313.html
The 'gherkin' module discussed there now lives in the cheeseshop as
part of the FibraNet package.
http://cheeseshop.python.org/pypi/FibraNet
I love benchmarks, especially when they come around for the second time.
I wrote a silly script which compares dumps performance between
different serialization modules for different simple objects using
Python 2.4.3. All figures are 'dumps per second'.
test: a tuple: ("a" * 1024,1.0,[1,2,3],{'1':2,'3':4})
gherkin: 10895.7762314
pickle: 6510.97245984
cPickle: 34218.5455317
marshal: 85562.2443672
xmlrpclib: 9468.0766772
test: a large string: 'a' * 10240
gherkin: 45955.4065455
pickle: 10209.0239868
cPickle: 13773.8138516
marshal: 24937.002069
xmlrpclib: Traceback
test: a small string: 'a' * 128
gherkin: 73453.0960495
pickle: 28357.0210654
cPickle: 122997.592425
marshal: 202428.776201
xmlrpclib: Traceback
test: a tupe of ints: tuple(range(64))
gherkin: 4522.06801154
pickle: 2273.12937965
cPickle: 23969.9306043
marshal: 143691.72582
xmlrpclib: 2781.3083894
Marshal is very quick for most cases, but still has this warning in
the documentation.
"""Warning: The marshal module is not intended to be secure against
erroneous or maliciously constructed data. Never unmarshal data
received from an untrusted or unauthenticated source."""
-Sw
More information about the Python-Dev
mailing list