Skip to content

fix(relative): group month and year adjustments - #360

Open
anastygnome wants to merge 1 commit into
uutils:mainfrom
anastygnome:split/month-year-grouping
Open

anastygnome wants to merge 1 commit into
uutils:mainfrom
anastygnome:split/month-year-grouping

Conversation

@anastygnome

@anastygnome anastygnome commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Accumulate relative year/month/day/time fields before applying them.
  • Normalize grouped year/month changes with GNU-compatible overflow behavior.
  • Add chained month/year regression coverage

@anastygnome
anastygnome force-pushed the split/month-year-grouping branch from e8728e3 to 8921369 Compare November 12, 2026 11:57
@codspeed

codspeed Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will degrade performance by 2.16%

2 warnings

⚠️ 11 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚠️ 6 benchmarks with a significant change ran on different hardware

Their base and head results were measured on machines with a different CPU, core count or memory, so the changes might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

⚡ 1 improved benchmark
❌ 5 regressed benchmarks
✅ 15 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ parse_relative_time_complex 62.4 µs 65.3 µs -4.48%
❌ parse_yesterday 31.1 µs 32.4 µs -4.14%
❌ parse_tomorrow 30.6 µs 31.8 µs -4.04%
❌ parse_weekday 42.6 µs 44.1 µs -3.26%
❌ parse_date_only 27.9 µs 28.9 µs -3.18%
⚡ parse_now 30.1 µs 28.3 µs +6.6%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing anastygnome:split/month-year-grouping (6535675) with main (5a1a032)

Open in CodSpeed

@codecov

codecov Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.93%. Comparing base (5a1a032) to head (6535675).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #360      +/-   ##
==========================================
+ Coverage   98.91%   98.93%   +0.01%     
==========================================
  Files          21       21              
  Lines        4713     4794      +81     
  Branches      138      142       +4     
==========================================
+ Hits         4662     4743      +81     
  Misses         50       50              
  Partials        1        1              
Flag Coverage Δ
macos_latest 98.93% <100.00%> (+0.01%) ⬆️
ubuntu_latest 98.93% <100.00%> (+0.01%) ⬆️
windows_latest 13.09% <44.23%> (+0.64%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@anastygnome
anastygnome force-pushed the split/month-year-grouping branch from 8921369 to 54e0251 Compare November 15, 2026 12:29
@anastygnome

Copy link
Copy Markdown
Contributor Author

@sylvestre can we merge as is? The perf impact is already adressed in the perf pr

@anastygnome
anastygnome force-pushed the split/month-year-grouping branch from 54e0251 to 6a2a923 Compare November 16, 2026 11:04
Comment thread src/items/builder.rs Resolved
Comment thread src/items/builder.rs Resolved
Comment thread src/items/builder.rs Resolved
Comment thread src/items/builder.rs Resolved
Comment thread tests/date.rs Resolved
@sylvestre

Copy link
Copy Markdown
Contributor

thanks for this PR!
The approach looks right, but the new code repeats itself (inline comments). CodSpeed also reports 2 regressed benchmarks, could you please check them?

@anastygnome

Copy link
Copy Markdown
Contributor Author

@sylvestre will address your comments.
The codspeed will be handled in the perf pr if that's ok.

@anastygnome
anastygnome force-pushed the split/month-year-grouping branch from eca934f to 3ac84ad Compare November 19, 2026 07:01
@anastygnome
anastygnome force-pushed the split/month-year-grouping branch 4 times, most recently from 269de9c to 66e5bb1 Compare November 22, 2026 10:16
@sylvestre

Copy link
Copy Markdown
Contributor

thanks for working on this!
The unused TryFrom<Relative> for Span in relative.rs is still there. It is probably what turns codecov/project red, could you please remove it?
The manual nanosecond normalization in apply_relative_time also remains.

Comment thread src/items/builder.rs Resolved
@anastygnome
anastygnome force-pushed the split/month-year-grouping branch from 66e5bb1 to 0048971 Compare November 23, 2026 06:40
@anastygnome

Copy link
Copy Markdown
Contributor Author

@sylvestre all done

@anastygnome
anastygnome force-pushed the split/month-year-grouping branch from 0048971 to 6535675 Compare November 23, 2026 06:40
@anastygnome

Copy link
Copy Markdown
Contributor Author

Regression is normal, extra compute and branching (at such a small timescale)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants