Kaydet (Commit) e0b90423 authored tarafından Guido van Rossum's avatar Guido van Rossum

Add a comment explaining that struct.pack() beats marshal.dumps(), but

marshal.loads() beats struct.unpack()!  Possibly because the latter
creates a one-tuple. :-(
üst 5c938d00
...@@ -45,6 +45,9 @@ compatible_formats = ["1.0", # Original protocol 0 ...@@ -45,6 +45,9 @@ compatible_formats = ["1.0", # Original protocol 0
"2.0", # Protocol 2 "2.0", # Protocol 2
] # Old format versions we can read ] # 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 mloads = marshal.loads
class PickleError(Exception): class PickleError(Exception):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment