date: print unknown %f and %Q conversions literally like GNU - #14672
Dummy-pixel-hash wants to merge 3 commits into
Conversation
jiff implements %f (fractional seconds) and %Q (timezone abbreviation), which GNU leaves literal, so `date +%f` printed nanoseconds. Escape those specifiers, with any flags or width, into literals before formatting, matching GNU output including its width and flag quirks for unknown conversions. Also keep %O on %Of/%OQ, where it cannot be a modifier. Fixes uutils#14600.
Merging this PR will improve performance by 22.06%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Simulation | complex_relative_date |
396.4 µs | 324.8 µs | +22.06% |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing Dummy-pixel-hash:date-literal-percent-f (a5a6640) with main (b60091b)2
Footnotes
-
408 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. ↩
-
No successful run was found on
main(41c3451) during the generation of this report, so b60091b was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
|
GNU testsuite comparison: |
| Some(format_with_modifiers(date, format_string, config)) | ||
| } | ||
|
|
||
| /// Escape conversion specifiers that jiff renders but GNU `date` leaves literal. |
There was a problem hiding this comment.
do we need 20 lines of comments that nobody will read? :)
Fixes #14600.
jiff implements %f (fractional seconds) and %Q (timezone abbreviation), which GNU leaves literal, so
date +%fprinted nanoseconds. This escapes those specifiers, with any flags or width, into literals before formatting, matching GNU output including its width and flag quirks for unknown conversions. It also keeps %O on %Of/%OQ, where it cannot be a modifier.