mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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:
parent
350c7229be
commit
ea99c5c949
5 changed files with 1885 additions and 548 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue