On Wed, Aug 19, 2015 at 1:25 PM, Guido van Rossum <[email protected]> wrote:
> Rather than prolonging the debate, let me just reject PEP 500. That is certainly within your powers, but before you do, let me substantiate my claim about 10x performance penalty. $ python3 -m timeit -s "from datetime import datetime, timezone; t = datetime.now(timezone.utc); l = t.astimezone()" "l - t" 1000000 loops, best of 3: 0.448 usec per loop $ python3 -m timeit -s "from datetime import datetime, timezone; t = datetime.now(); l = t" "l - t" 10000000 loops, best of 3: 0.0444 usec per loop Currently, subtracting aware datetimes with the same tzinfo incurs no penalty $ python3 -m timeit -s "from datetime import datetime, timezone; t = datetime.now(timezone.utc); l = t" "l - t" 10000000 loops, best of 3: 0.0436 usec per loop With PEP 500, we can have timeline arithmetic without the overhead of two round trips to tzinfo. I will be happy if someone would demonstrate how to achieve the same by simpler means.
_______________________________________________ Datetime-SIG mailing list [email protected] https://mail.python.org/mailman/listinfo/datetime-sig The PSF Code of Conduct applies to this mailing list: https://www.python.org/psf/codeofconduct/
