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 belopolsky, lemburg, p-ganssle, serhiy.storchaka, steve.dower, twouters
Date 2020-05-11.21:38:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1589233133.53.0.780783609113.issue40503@roundup.psfhosted.org>
In-reply-to
Content
Here are some benchmarks run using the latest implementation. The pure Python code is pretty optimized, but the C code is still ~4-5x faster.

Running from_utc in zone Europe/Paris
c_zoneinfo: mean: 494.82 ns ± 3.80 ns; min: 489.23 ns (k=5, N=500000)
py_zoneinfo: mean: 2.48 µs ± 79.17 ns; min: 2.42 µs (k=5, N=100000)
dateutil: mean: 10.41 µs ± 209.97 ns; min: 10.17 µs (k=5, N=50000)
pytz: mean: 4.69 µs ± 252.70 ns; min: 4.39 µs (k=5, N=50000)

Running to_utc in zone Europe/Paris
c_zoneinfo: mean: 539.61 ns ± 25.68 ns; min: 514.39 ns (k=5, N=500000)
py_zoneinfo: mean: 2.01 µs ± 61.69 ns; min: 1.94 µs (k=5, N=100000)
dateutil: mean: 7.88 µs ± 506.89 ns; min: 7.25 µs (k=5, N=50000)
pytz: mean: 773.02 ns ± 14.11 ns; min: 759.56 ns (k=5, N=500000)

Running utcoffset in zone Europe/Paris
c_zoneinfo: mean: 329.34 ns ± 36.31 ns; min: 302.88 ns (k=5, N=1000000)
py_zoneinfo: mean: 1.57 µs ± 9.58 ns; min: 1.55 µs (k=5, N=200000)
dateutil: mean: 6.28 µs ± 86.61 ns; min: 6.16 µs (k=5, N=50000)
pytz: mean: 461.47 ns ± 2.07 ns; min: 458.91 ns (k=5, N=500000)


`utcoffset()` is very likely to be called possibly many times in certain hot loops (including implicitly as it's part of hash and equality checks).
History
Date User Action Args
2020-05-11 21:38:53p-gansslesetrecipients: + p-ganssle, lemburg, twouters, belopolsky, serhiy.storchaka, steve.dower
2020-05-11 21:38:53p-gansslesetmessageid: <1589233133.53.0.780783609113.issue40503@roundup.psfhosted.org>
2020-05-11 21:38:53p-gansslelinkissue40503 messages
2020-05-11 21:38:52p-gansslecreate