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, pitrou
Date 2010-09-24.01:06:56
SpamBayes Score 2.8782065e-07
Marked as misclassified No
Message-id <1285290424.33.0.0824621979691.issue9935@psf.upfronthosting.co.za>
In-reply-to
Content
This is a bunch of assorted optimizations which make pickling of user-defined classes quite a bit faster.

Example on a minimal instance:

$ python -m timeit -s "import pickle; import collections, __main__; __main__.X=type('X', (), {}); x=X()" "pickle.dumps(x)"
-> before: 100000 loops, best of 3: 8.11 usec per loop
-> after: 100000 loops, best of 3: 2.95 usec per loop

Example on a namedtuple:

$ python -m timeit -s "import pickle; import collections, __main__; __main__.X=collections.namedtuple('X', 'a'); x=X(5)" "pickle.dumps(x)"
-> before: 100000 loops, best of 3: 9.52 usec per loop
-> after: 100000 loops, best of 3: 3.78 usec per loop

Unladen Swallow's pickling benchmark:

### pickle ###
Min: 0.792903 -> 0.704288: 1.1258x faster
Avg: 0.796241 -> 0.706073: 1.1277x faster
Significant (t=39.374217)
Stddev: 0.00410 -> 0.00307: 1.3342x smaller
Timeline: http://tinyurl.com/38elzvv
History
Date User Action Args
2010-09-24 01:07:04pitrousetrecipients: + pitrou, belopolsky, alexandre.vassalotti
2010-09-24 01:07:04pitrousetmessageid: <1285290424.33.0.0824621979691.issue9935@psf.upfronthosting.co.za>
2010-09-24 01:06:59pitroulinkissue9935 messages
2010-09-24 01:06:58pitroucreate