[New-bugs-announce] [issue5670] Speed up pickling of dicts in cPickle

Collin Winter report at bugs.python.org
Thu Apr 2 20:53:51 CEST 2009

New submission from Collin Winter <collinw at gmail.com>:

The attached patch adds another version of cPickle.c's batch_dict(),
batch_dict_exact(), which is specialized for "type(x) is dict". This
provides a nice performance boost when pickling objects that use

Min: 2.216 -> 1.858: 19.24% faster
Avg: 2.238 -> 1.889: 18.50% faster
Significant (t=106.874099, a=0.95)

Benchmark is at
(driver is  ../perf.py; perf.py was run with "--rigorous -b pickle").

This patch passes all the tests added in issue 5665. I would recommend
reviewing that patch first. I'll port to py3k once this is reviewed for

components: Extension Modules
files: cpickle_dict.patch
keywords: needs review, patch
messages: 85239
nosy: collinwinter
severity: normal
status: open
title: Speed up pickling of dicts in cPickle
type: performance
versions: Python 2.7
Added file: http://bugs.python.org/file13584/cpickle_dict.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list