Paul Ganssle <p.gans...@gmail.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44307>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to