Alexander Belopolsky <belopol...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue9051>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to