This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients alexandre.vassalotti, belopolsky, collinwinter, pitrou, skip.montanaro, vstinner
Date 2010-09-06.17:35:10
SpamBayes Score 3.2512423e-07
Marked as misclassified No
Message-id <1283794515.72.0.0243022927379.issue9410@psf.upfronthosting.co.za>
In-reply-to
Content
Here is a patch. Benchmark numbers:

* dumps():

./python -m timeit -s "import pickle, io; d={(x, 'a'): x  for x in range(10000)}" "pickle.dumps(d)"

-> before: 100 loops, best of 3: 7.47 msec per loop
-> after: 100 loops, best of 3: 2.45 msec per loop

* loads():

./python -m timeit -s "import pickle, io; d={(x, 'a'): x  for x in range(10000)}; d=pickle.dumps(d)" "pickle.loads(d)"

-> before: 100 loops, best of 3: 12.1 msec per loop
-> after: 100 loops, best of 3: 2.62 msec per loop

* dump():

./python -m timeit -s "import pickle, io; d={(x, 'a'): x  for x in range(10000)}" "pickle.dump(d, io.BytesIO())"
-> before: 100 loops, best of 3: 13.2 msec per loop
-> after: 100 loops, best of 3: 2.54 msec per loop

* load():

./python -m timeit -s "import pickle, io; d={(x, 'a'): x  for x in range(10000)}; d=pickle.dumps(d)" "pickle.load(io.BytesIO(d))"
-> before: 100 loops, best of 3: 12.7 msec per loop
-> after: 100 loops, best of 3: 11.6 msec per loop


As you can see, load() doesn't really benefit from the buffering improvements. The three methods see quite massive speedups.
History
Date User Action Args
2010-09-06 17:35:15pitrousetrecipients: + pitrou, skip.montanaro, collinwinter, belopolsky, vstinner, alexandre.vassalotti
2010-09-06 17:35:15pitrousetmessageid: <1283794515.72.0.0243022927379.issue9410@psf.upfronthosting.co.za>
2010-09-06 17:35:14pitroulinkissue9410 messages
2010-09-06 17:35:14pitroucreate