Repository navigation
performance improvements - #355
anastygnome wants to merge 12 commits into
Conversation
d8861cd to
afd20cd
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #355 +/- ##
==========================================
- Coverage 98.97% 98.73% -0.25%
==========================================
Files 21 17 -4
Lines 4696 4890 +194
Branches 143 159 +16
==========================================
+ Hits 4648 4828 +180
- Misses 47 61 +14
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will improve performance by 18.22%2 warnings
Performance Changes
Tip Curious why performance improved? Comment Comparing |
|
I really like you didn't touch tests :) |
|
I did ? |
well, I just rewrote the parser in place and rechecked every rule, want me to add some? |
8b8bcb7 to
60bac2b
Compare
24cb12a to
201ca9e
Compare
7998859 to
352c682
Compare
|
please remove the fixup! |
352c682 to
b9aae81
Compare
e0f4d45 to
0d40353
Compare
Choose the date parser from the first character instead of trying every form.
Parse shared time and offset prefixes once to reduce backtracking in common ISO inputs.
Choose the keyword or numeric path from the first character instead of trying failed alternatives.
Route text and numeric ordinals separately before parsing either form.
Skip the separated-date parser when the input is clearly a compact ISO date.
Avoid unnecessary timestamp and timezone parser probes on common inputs.
Use the crate-level limit in year parsing instead of keeping a second copy.
0d40353 to
bfea048
Compare
| t.second(), | ||
| t.subsec_nanosecond(), | ||
| )?; | ||
| let named_zone_is_local = self |
There was a problem hiding this comment.
this isn't a perf change: named zones, DST, relative grouping
please split that into its own pr
There was a problem hiding this comment.
Oh I removed draft by mistake, the idea is to use it to benchmark the different PRs pending to make sure I don't create regression
| t.second(), | ||
| t.subsec_nanosecond(), | ||
| )?; | ||
| let named_zone_is_local = self |
There was a problem hiding this comment.
offset.name() is computed twice here and again in 4d, could be dedup, no?
the if let Some(offset) below can't fail either
| // Chained relative operations. | ||
| #[rstest] | ||
| // Feb 29, 2020 + 1 year = March 1, 2021; + 1 month = April 1, 2021 | ||
| // GNU groups relative years and months before normalizing: 2020-02-29 plus |
There was a problem hiding this comment.
this changes existing expected values in a "performance" PR
please move it to a separate PR, with the GNU date output in the description
| "adt" => (true, 3, 0, false), | ||
| "a" => (false, 1, 0, true), | ||
| // Australian abbreviations accepted by GNU date. | ||
| "aest" => (false, 10, 0, true), |
There was a problem hiding this comment.
are you sure GNU accepts AEST with TZ=UTC0? i don't think it is in its table
please document how it was checked
| .to_string() | ||
| } | ||
|
|
||
| fn check_canonical(input: &str, expected: &str) { |
There was a problem hiding this comment.
please move these helpers into tests/common/mod.rs, they duplicate check_absolute/check_relative
|
|
||
| #[test] | ||
| #[ignore] | ||
| fn test_relative_year_then_month() { |
There was a problem hiding this comment.
ignored tests are dead code, please remove them (or fix them)
this one is also already covered by feb29_plus_year_plus_month
| // $ TZ=America/New_York date -d '8z' # 2026-08-25 04:00 -0400 | ||
| // | ||
| // Verified against GNU coreutils 9.4. | ||
| // `j` follows the base zone; other military letters use fixed offsets. |
There was a problem hiding this comment.
why remove the GNU examples and the "verified against" notes? they were useful, please keep them
|
thanks for this PR! |
|
@sylvestre they're already split, was supposed to remain a draft before every other one is merged |
Depends on #350