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 serhiy.storchaka
Recipients alexandre.vassalotti, belopolsky, fdrake, mark.dickinson, ned.deily, pitrou, python-dev, serhiy.storchaka, tim.peters, vstinner
Date 2015-11-16.09:53:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1447667640.06.0.627095424109.issue9051@psf.upfronthosting.co.za>
In-reply-to
Content
>>> import pickle, pickletools, datetime
>>> len(pickle.dumps([datetime.datetime.utcfromtimestamp(i) for i in range(10000)], 3)) / 10000
30.9283
>>> len(pickle.dumps([datetime.datetime.fromtimestamp(i, datetime.timezone.utc) for i in range(10000)], 3)) / 10000
32.936
>>> len(pickle.dumps([datetime.datetime.utcfromtimestamp(i) for i in range(10000)], 4)) / 10000
19.0074
>>> len(pickle.dumps([datetime.datetime.fromtimestamp(i, datetime.timezone.utc) for i in range(10000)], 4)) / 10000
21.0144

In best case the UTC timezone costs only 2 bytes per datetime instance (BINGET + 1-byte index). In worst case it can cost 5 bytes (LONG_BINGET + 4-bytes index). Saving few bytes for single timezone instance has significant effect only for small pickled data. But in this case it is more advantageous to save a datetime just as a timestamp. I suggest to close this issue.
History
Date User Action Args
2015-11-16 09:54:00serhiy.storchakasetrecipients: + serhiy.storchaka, tim.peters, fdrake, mark.dickinson, belopolsky, pitrou, vstinner, alexandre.vassalotti, ned.deily, python-dev
2015-11-16 09:54:00serhiy.storchakasetmessageid: <1447667640.06.0.627095424109.issue9051@psf.upfronthosting.co.za>
2015-11-16 09:54:00serhiy.storchakalinkissue9051 messages
2015-11-16 09:53:59serhiy.storchakacreate