From: Guido van Rossum Date: Tue, 28 Jan 2003 03:17:21 +0000 (+0000) Subject: Add a comment explaining that struct.pack() beats marshal.dumps(), but X-Git-Tag: v2.3c1~2254 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e0b904232fc93a818aae0740cfb7b076a513a5da;p=thirdparty%2FPython%2Fcpython.git Add a comment explaining that struct.pack() beats marshal.dumps(), but marshal.loads() beats struct.unpack()! Possibly because the latter creates a one-tuple. :-( --- diff --git a/Lib/pickle.py b/Lib/pickle.py index b812e675c5aa..cb27f8ab859a 100644 --- a/Lib/pickle.py +++ b/Lib/pickle.py @@ -45,6 +45,9 @@ compatible_formats = ["1.0", # Original protocol 0 "2.0", # Protocol 2 ] # Old format versions we can read +# Why use struct.pack() for pickling but marshal.loads() for +# unpickling? struct.pack() is 40% faster than marshal.loads(), but +# marshal.loads() is twice as fast as struct.unpack()! mloads = marshal.loads class PickleError(Exception):