Skip to content

Conversation

@CrazyRoka
Copy link
Contributor

Previously, resolve_tz_abbreviation would parse a date string to calculate the timezone offset, format the result back into a string, and return it. The calling function parse_date would then parse this string a second time.

This change modifies resolve_tz_abbreviation to return an Option<Zoned> directly. If the abbreviation logic succeeds, we avoid the second parsing step and the intermediate string allocations, significantly improving performance for inputs containing timezone abbreviations (e.g., "EST").

@CrazyRoka CrazyRoka force-pushed the date-optimize-abbreviation branch from 3d81ea7 to fe65d17 Compare January 2, 2026 21:59
@codspeed-hq
Copy link

codspeed-hq bot commented Jan 2, 2026

CodSpeed Performance Report

Merging #9997 will improve performance by 87.09%

Comparing CrazyRoka:date-optimize-abbreviation (fe65d17) with main (c96b96e)

Summary

⚡ 3 improvements
✅ 136 untouched
⏩ 30 skipped1

Benchmarks breakdown

Benchmark BASE HEAD Efficiency
file_tz_abbreviations[1000] 29.6 ms 15.9 ms +86.06%
file_tz_abbreviations[100] 6.4 ms 5 ms +27.46%
file_tz_abbreviations[10000] 294.3 ms 157.3 ms +87.09%

Footnotes

  1. 30 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@CrazyRoka CrazyRoka marked this pull request as ready for review January 2, 2026 22:23
@sylvestre
Copy link
Contributor

impressive perf win

@sylvestre sylvestre merged commit c9099cb into uutils:main Jan 3, 2026
128 of 129 checks passed
@CrazyRoka CrazyRoka deleted the date-optimize-abbreviation branch January 3, 2026 18:09
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