Performance
This release is focused on parsing speed via a new two-layer pre-filter pattern: a family-level regex gate followed by cheap byte-level checks within individual parsers, short-circuiting before the heavier regex runs.
New byte pre-filters added:
| Parser | Pre-filter | Effect |
|---|---|---|
ymd_hms_z |
len < 17 || byte[10] != whitespace |
Eliminates bare YYYY-MM-DD dates instantly |
ymd_z |
len <= 10 |
Skips inputs that can't have a timezone |
month_mdy_hms_z |
Scan for isolated 4-digit year | Eliminates inputs like May 27 02:45:27 with no year |
month_dmy_hms |
!contains(':') |
Skips regex entirely for date-only inputs |
month_dmy |
Trailing 4-digit byte check | Skips the failing %d %B %y parse attempt for 4-digit years |
Benchmark improvements vs. 0.13.0 baseline:
| Benchmark | Change |
|---|---|
parse_all/accepted_formats |
−8% |
parse_throughput/1000_dates |
−6.6% |
rfc3339 (2017-11-25T22:34:50Z) |
−21% |
ymd_hms_z (2019-11-29 08:08:05-08) |
−10.5% |
month_dmy (1 July 2013) |
−11.6% |
ymd_z (2021-02-21 PST) |
−8.3% |
month_mdy_hms (May 8, 2009 5:57:51 PM) |
−8% |
month_mdy_hms_z (May 02, 2021 15:51 UTC) |
−7.9% |
No regressions across any format.
Dependencies
- Minimum supported Rust version bumped to 1.93 (was 1.85)
criteriondev-dependency bumped from 0.5 → 0.8
Internal
- Refactored conditional branches in
datetime.rsto use Rust let-chains andis_none_orfor cleaner control flow