gh-148085: `datetime` cache `time` module lookups by maurycy · Pull Request #148088 · python/cpython · GitHub
Skip to content
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Speed up :meth:`~datetime.date.timetuple` and :meth:`~datetime.date.strftime`
by caching the ``time.struct_time`` and ``time.strftime`` lookups, and
:meth:`~datetime.datetime.today` by reading the clock directly instead of
calling :func:`time.time`. Patching :mod:`time` after importing
:mod:`datetime` no longer affects these methods. Patch by Maurycy
Pawłowski-Wieroński.
60 changes: 35 additions & 25 deletions Modules/_datetimemodule.c
Loading