sed: copy R text and e command output unchanged, as GNU sed does - #590
DePasqualeOrg wants to merge 1 commit into
Conversation
Merging this PR will improve performance by 35.38%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | access_log_append |
1.5 s | 1.1 s | +35.38% |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing DePasqualeOrg:fix-raw-r-and-e-output (35f178a) with main (1113479)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #590 +/- ##
==========================================
+ Coverage 83.86% 83.91% +0.04%
==========================================
Files 14 14
Lines 7203 7206 +3
Branches 424 423 -1
==========================================
+ Hits 6041 6047 +6
+ Misses 1157 1154 -3
Partials 5 5
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:
|
|
Closing: this change is now part of #589, because each needed the other. |
Please ignore this PR until it is marked as ready for review
GNU sed copies the line that
Rreads, and the output of thee commandform, to the output exactly as they are. uutils sed treats them as lines and adds a newline when they lack one. With a filefthat containsxand no newline,printf 'a\nb\n' | sed 'R f'printsxandbon separate lines, while GNU sed printsxb. Likewise,printf 'a\n' | sed '1e printf hi'printshion a line of its own, while GNU sed printshia.This PR adds
OutputBuffer::write_raw, which writes a newline that the previous output line lacks and then the bytes unchanged, and uses it for appended text andeoutput. It also makeslprint$for an empty pattern space whose line lacked a newline, as GNU sed does.codecov/patchfails only because CI does not count the coverage of tests that run the sed binary; it should pass after #591 is merged.