Skip to content

performance improvements - #355

Draft
anastygnome wants to merge 8 commits into
uutils:mainfrom
anastygnome:perf/performance-improvements
Draft

anastygnome wants to merge 8 commits into
uutils:mainfrom
anastygnome:perf/performance-improvements

Conversation

@anastygnome

@anastygnome anastygnome commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Depends on #350

Choose the date parser from the first character instead of trying every form.
@anastygnome
anastygnome force-pushed the perf/performance-improvements branch 4 times, most recently from d8861cd to afd20cd Compare November 10, 2026 11:31
@codecov

codecov Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.15966% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.98%. Comparing base (b518712) to head (ad03c84).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/items/offset.rs 98.55% 1 Missing ⚠️
src/items/time.rs 96.15% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #355      +/-   ##
==========================================
+ Coverage   98.90%   98.98%   +0.08%     
==========================================
  Files          21       21              
  Lines        4546     4714     +168     
  Branches      142      144       +2     
==========================================
+ Hits         4496     4666     +170     
+ Misses         49       47       -2     
  Partials        1        1              
Flag Coverage Δ
macos_latest ?
ubuntu_latest 98.98% <99.15%> (+0.08%) ⬆️
windows_latest 12.09% <46.63%> (-0.10%) ⬇️

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.

@codspeed

codspeed Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will improve performance by 16.98%

1 warning

⚠️ 16 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

⚡ 16 improved benchmarks
✅ 5 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ parse_relative_time 46.5 µs 36.5 µs +27.6%
⚡ parse_extended_year_relative 55.4 µs 43.9 µs +26.26%
⚡ parse_invalid_input 38.9 µs 30.8 µs +26.11%
⚡ parse_datetime_with_delta 74.9 µs 62.2 µs +20.49%
⚡ parse_weekday 40.5 µs 33.6 µs +20.43%
⚡ parse_relative_time_complex 60.4 µs 50.7 µs +19.08%
⚡ parse_datetime_ending_in_z 59.7 µs 51.1 µs +16.89%
⚡ parse_extended_year_rollover 80.3 µs 69 µs +16.4%
⚡ parse_now 29.8 µs 25.6 µs +16.3%
⚡ parse_datetime_with_tz_name 61.7 µs 53.1 µs +16.22%
⚡ parse_ctime_format 69.4 µs 59.8 µs +15.95%
⚡ parse_timezone_offset 58.5 µs 50.7 µs +15.39%
⚡ parse_yesterday 30.5 µs 27.5 µs +10.86%
⚡ parse_iso_datetime 49.4 µs 45.2 µs +9.24%
⚡ parse_tomorrow 30 µs 27.5 µs +8.96%
⚡ parse_iso_datetime_t_separator 49.9 µs 46.3 µs +7.93%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing anastygnome:perf/performance-improvements (ad03c84) with main (22d40aa)

Open in CodSpeed

@sylvestre

Copy link
Copy Markdown
Contributor

I really like you didn't touch tests :)

@anastygnome

Copy link
Copy Markdown
Contributor Author

I did ?

Comment thread src/items/offset.rs Resolved
@sylvestre

Copy link
Copy Markdown
Contributor

@anastygnome

Copy link
Copy Markdown
Contributor Author

https://github.com/uutils/parse_datetime/tree/main/tests these

well, I just rewrote the parser in place and rechecked every rule, want me to add some?

@anastygnome
anastygnome force-pushed the perf/performance-improvements branch from 322c531 to 7857ca0 Compare November 10, 2026 14:32
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 probing the TZ rule parser when the input does not start with the TZ prefix.
Use the crate-level limit in year parsing instead of keeping a second copy.
@anastygnome
anastygnome force-pushed the perf/performance-improvements branch from 7857ca0 to 178cb8a Compare November 10, 2026 14:33
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