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 p-ganssle
Recipients Anthony Sottile, corona10, p-ganssle, rkm
Date 2021-06-04.19:55:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1622836533.53.0.011664803928.issue44307@roundup.psfhosted.org>
In-reply-to
Content
Yeah, I knew this was slower and it's been on my long list to look at it (tied to this is the fact that `datetime.today()` is basically just a slow version of `datetime.now()`, in defiance of user expectations).

My inclination is that we shouldn't re-implement `fromtimestamp` in `date.today`, but rather call `date_fromtimestamp` in the fast path. I believe that incurs the overhead of creating one additional Python object (an integer), but if it's a sufficiently significant speedup, we could possibly refactor `date_fromtimestamp` to a version that accepts a C integer and a version that accepts a Python integer, then call the version accepting a C integer.

I think this won't give any speedup to `datetime.today`, since `datetime.today` will still take the slow path. If we care about this, we *may* be able to implement `datetime.today` as an alias for `datetime.now(None)`, assuming there are no behavioral differences between the two.
History
Date User Action Args
2021-06-04 19:55:33p-gansslesetrecipients: + p-ganssle, Anthony Sottile, corona10, rkm
2021-06-04 19:55:33p-gansslesetmessageid: <1622836533.53.0.011664803928.issue44307@roundup.psfhosted.org>
2021-06-04 19:55:33p-gansslelinkissue44307 messages
2021-06-04 19:55:33p-gansslecreate