Issue #9410: Various optimizations to the pickle module, leading to

speedups up to 4x (depending on the benchmark).  Mostly ported from
Unladen Swallow; initial patch by Alexandre Vassalotti.
This commit is contained in:
Antoine Pitrou 2010-09-09 18:33:21 +00:00
parent 350c7229be
commit ea99c5c949
5 changed files with 1885 additions and 548 deletions

View file

@ -37,6 +37,18 @@ class PyPicklerTests(AbstractPickleTests):
return u.load()
class InMemoryPickleTests(AbstractPickleTests):
pickler = pickle._Pickler
unpickler = pickle._Unpickler
def dumps(self, arg, proto=None):
return pickle.dumps(arg, proto)
def loads(self, buf):
return pickle.loads(buf)
class PyPersPicklerTests(AbstractPersistentPicklerTests):
pickler = pickle._Pickler
@ -95,7 +107,8 @@ def test_main():
tests.extend([CPicklerTests, CPersPicklerTests,
CDumpPickle_LoadPickle, DumpPickle_CLoadPickle,
PyPicklerUnpicklerObjectTests,
CPicklerUnpicklerObjectTests])
CPicklerUnpicklerObjectTests,
InMemoryPickleTests])
support.run_unittest(*tests)
support.run_doctest(pickle)