Choosing the fastest datetime library for Python
Python has several popular datetime libraries: the standard-library datetime, python-dateutil, Arrow, Pendulum, udatetime, Whenever, plus parsing functionality in Pydantic and pandas.
If performance matters, which one should you use?
The benchmark-datetime project compares three kinds of operations:
- parsing datetime values
- manipulating dates and times
- dumping datetime values to strings
The current benchmark runs on Python 3.14.7 and compares libraries only where the operation is supported and relevant.
The short answer is: Whenever is the fastest option in 10 of the 12 benchmark groups.
Whenever is usually the fastest
For adding a duration:
| Library | Mean time |
|---|---|
| Whenever | 387 ns |
datetime | 976 ns |
| Pendulum | 4.53 µs |
| Arrow | 8.04 µs |
For getting the current local time:
| Library | Mean time |
|---|---|
| Whenever | 95.3 ns |
udatetime | 121 ns |
datetime | 170 ns |
| Pendulum | 974 ns |
| Arrow | 3.25 µs |
For dumping a datetime to ISO format:
| Library | Mean time |
|---|---|
| Whenever | 119 ns |
udatetime | 424 ns |
datetime | 1.05 µs |
| Arrow | 1.08 µs |
| Pendulum | 1.54 µs |
The same pattern appears across most of this benchmark suite: Whenever has noticeably lower overhead than the alternatives in these tests.
Parsing shows the biggest differences
ISO 8601 parsing is especially interesting:
| Library | Mean time |
|---|---|
| Whenever | 89.6 ns |
datetime.fromisoformat() | 103 ns |
| Pydantic | 399 ns |
udatetime | 512 ns |
| pandas | 2.74 µs |
python-dateutil | 4.64 µs |
| Pendulum | 4.96 µs |
| Arrow | 33.9 µs |
Here, the standard library is almost as fast as Whenever.
Arrow is hundreds of times slower in this particular benchmark because arrow.get() is a more general parsing interface, while datetime.fromisoformat() and OffsetDateTime.parse_iso() are specialized APIs.
That distinction matters: the benchmark measures the actual API call used for the operation, not some abstract notion of library speed.
The exceptions are useful
Whenever does not win every benchmark.
For a weekday lookup, Python’s datetime and udatetime take about 58 ns, while Whenever takes about 172 ns.
The reason is simple: datetime exposes .weekday() directly. Whenever needs a longer call chain to produce the same 0–6 numbering:
dt.date().day_of_week().value - 1
ISO 8601 duration parsing is another exception. Pydantic takes about 352 ns, while Whenever takes about 4.73 µs because it first parses an ItemizedDelta and then converts it to TimeDelta.
These cases show why one overall score would be misleading. API design affects performance too.
What should you choose?
If raw datetime performance is important, Whenever is the strongest option in this benchmark.
But datetime remains very competitive, especially for ISO 8601 parsing and simple operations, and it requires no extra dependency.
Arrow and Pendulum provide higher-level APIs and are slower in many of these benchmarks. Choosing them for that convenience can be a reasonable trade-off when datetime operations are not a bottleneck.
Pydantic and pandas should generally be chosen for their broader functionality rather than as standalone datetime libraries, although their existing datetime APIs may be useful when those packages are already dependencies.
A practical approach is:
- Use
datetimeif it already does what is needed. - Consider Whenever when datetime operations are performance-sensitive.
- When using Arrow, Pendulum, Pydantic, or pandas for their functionality, benchmark the specific relevant operations rather than treating the whole library as fast or slow.
The full benchmark results, source code, and histograms are available in benchmark-datetime.