Message115724
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. |
|
Date |
User |
Action |
Args |
2010-09-06 17:35:15 | pitrou | set | recipients:
+ pitrou, skip.montanaro, collinwinter, belopolsky, vstinner, alexandre.vassalotti |
2010-09-06 17:35:15 | pitrou | set | messageid: <1283794515.72.0.0243022927379.issue9410@psf.upfronthosting.co.za> |
2010-09-06 17:35:14 | pitrou | link | issue9410 messages |
2010-09-06 17:35:14 | pitrou | create | |
|