Message117253
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 |
|
Date |
User |
Action |
Args |
2010-09-24 01:07:04 | pitrou | set | recipients:
+ pitrou, belopolsky, alexandre.vassalotti |
2010-09-24 01:07:04 | pitrou | set | messageid: <1285290424.33.0.0824621979691.issue9935@psf.upfronthosting.co.za> |
2010-09-24 01:06:59 | pitrou | link | issue9935 messages |
2010-09-24 01:06:58 | pitrou | create | |
|