From e0b904232fc93a818aae0740cfb7b076a513a5da Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 28 Jan 2003 03:17:21 +0000 Subject: [PATCH] Add a comment explaining that struct.pack() beats marshal.dumps(), but marshal.loads() beats struct.unpack()! Possibly because the latter creates a one-tuple. :-( --- Lib/pickle.py | 3 +++ 1 file changed, 3 insertions(+) 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): -- 2.47.3