[issue13503] improved efficiency of bytearray pickling by using bytes type instead of str

Antoine Pitrou report at bugs.python.org
Mon May 6 22:45:17 CEST 2013


Antoine Pitrou added the comment:

Serhiy Storchaka added the comment:
> 
> How about base64?
> 
>                 self.save_reduce(base64.b64decode,
>                                  (str(base64.b64encode(obj), 'ascii'),), obj=obj)
> 
> >>> len(dumps(bytes([200] * 10000), 2))
> 13372

It's statistically better (a fixed 1.33 expansion instead of 1.5 average), but ASCII bytearrays will pickle less efficiently than currently.

There's something else: we had enough regressions in the latest 2.7.x release, and we shouldn't risk adding new ones in the next release. Really, let's close this issue.

----------
nosy: +benjamin.peterson

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13503>
_______________________________________


More information about the Python-bugs-list mailing list