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 vstinner
Recipients belopolsky, berker.peksag, bmispelon, corona10, p-ganssle, rhettinger, serhiy.storchaka, taleinat, tim.peters, vstinner
Date 2019-09-05.11:16:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
./python.exe -m timeit -r11 -s 'import datetime' -s 'a ='
50000000 loops, best of 11: 8.72 nsec per loop

Let me know if the benchmark code is not appropriate

Hum wait, this benchmark measures the performance of the pass opcode... That's why it's so fast :-) -s 'a =' is run exactly once for the whole benchmark, not at each benchmark iteration...

I suggest you this microbenchmark instead:

./python.exe -m pyperf timeit -s 'import datetime; dt =' 'dt.isocalendar()'

For example, on my Fedora 30 with Python 3.7.4, I get:

Mean +- std dev: 108 ns +- 4 ns
Date User Action Args
2019-09-05 11:16:51vstinnersetrecipients: + vstinner, tim.peters, rhettinger, belopolsky, taleinat, berker.peksag, serhiy.storchaka, bmispelon, p-ganssle, corona10
2019-09-05 11:16:51vstinnersetmessageid: <>
2019-09-05 11:16:51vstinnerlinkissue24416 messages
2019-09-05 11:16:51vstinnercreate