[New-bugs-announce] [issue5671] Speed up pickling of lists in cPickle

Collin Winter report at bugs.python.org
Thu Apr 2 21:28:17 CEST 2009

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

The attached patch adds another version of cPickle.c's batch_list(),
batch_list_exact(), which is specialized for "type(x) is list". This
provides a nice performance boost when pickling objects that use
lists. This is similar to the approach taken in issue 5670, though the
performance boost on our benchmark is smaller:

Min: 2.231 -> 2.200: 1.39% faster
Avg: 2.266 -> 2.227: 1.72% faster
Significant (t=10.994064, a=0.95)

Benchmark is at
(driver is  ../perf.py; perf.py was run with "--rigorous -b pickle").
Workloads involving more lists will benefit more.

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_list.patch
keywords: needs review, patch
messages: 85250
nosy: collinwinter
severity: normal
status: open
title: Speed up pickling of lists in cPickle
type: performance
versions: Python 2.7
Added file: http://bugs.python.org/file13585/cpickle_list.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list