[Python-Dev] PEP for RFE 46738 (first draft)

Simon Wittber simonwittber at gmail.com
Sun Jun 19 02:49:02 CEST 2005


> Why this discussion of yet another serialization format?

Pickle is stated to be unsafe. Marshal is also stated to be unsafe.
XML can be bloated, and XML+gzip is quite slow.

Do size,speed, and security features have to mutually exclusive? No,
that possibly is why people have had to invent their own formats. I
can list four off the top of my head:

bencode (bittorrent)
jelly (twisted)
banana (twisted)
tofu (soya3d, looks like it is using twisted now... hmmm)

XML is simply not suitable for database appplications, real time data
capture and game/entertainment applications.

I'm sure other people have noticed this... or am I alone on this issue? :-)

Have a look at this contrived example:

import time

value = (("this is a record",1,2,1000001,"(08)123123123","some more
text")*10000)

import gherkin
t = time.clock()
s = gherkin.dumps(value)
print 'Gherkin encode', time.clock() - t, 'seconds'
t = time.clock()
gherkin.loads(s)
print 'Gherkin decode', time.clock() - t, 'seconds'

import xmlrpclib
t = time.clock()
s = xmlrpclib.dumps(value)
print 'XMLRPC encode', time.clock() - t, 'seconds'
t = time.clock()
xmlrpclib.loads(s)
print 'XMLRPC decode', time.clock() - t, 'seconds'

Which produces the output:

>pythonw -u "bench.py"
Gherkin encode 0.120689361357 seconds
Gherkin decode 0.395871262968 seconds
XMLRPC encode 0.528666352847 seconds
XMLRPC decode 9.01307819849 seconds


More information about the Python-Dev mailing list