[issue9051] Improve pickle format for aware datetime instances

Alexander Belopolsky report at bugs.python.org
Fri Jun 25 21:29:19 CEST 2010


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

I am attaching a python prototype implementing interned UTC instance pickling.  The patch is against sandbox revision r82218 of datetime.py.

Note that the pickling protocol requires that an instance or factory function is defined at the module level.

The pickle size saving is substantial:


>>> len(dumps(datetime.now(timezone.utc)))
61
>>> len(dumps(datetime.now(timezone.min)))
163

but there is still room for improvement:

>>> len(dumps(datetime.now()))
44

I do feel, however, that further improvements will see diminishing returns.

----------
keywords: +patch
Added file: http://bugs.python.org/file17769/issue9051-utc-pickle-proto.diff

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


More information about the Python-bugs-list mailing list