od: stream the output line instead of buffering it - #14692
Conversation
A line is padded up to the full -w width before the ascii dump, and the formatted fields themselves take about 4 bytes per input byte, so `od -w3037000500 -tcz` built a 12 GB String. Write the offset, the fields and the padding straight to the writer, tracking the line width as it goes instead of measuring a buffered string. Should fix tests/od/big-w.sh
Merging this PR will improve performance by 15.18%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Simulation | od_default |
601.3 ms | 511.8 ms | +17.49% |
| ⚡ | Simulation | od_chars |
948.2 ms | 831.2 ms | +14.07% |
| ⚡ | Simulation | od_hex_bytes |
991.8 ms | 870.1 ms | +14% |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing sylvestre:od-big (8c7ec47) with main (58490b3)2
Footnotes
-
418 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(848ad09) during the generation of this report, so 58490b3 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
|
GNU testsuite comparison: |
A line is padded up to the full -w width before the ascii dump, and the formatted fields themselves take about 4 bytes per input byte, so
od -w3037000500 -tczbuilt a 12 GB String. Write the offset, the fields and the padding straight to the writer, tracking the line width as it goes instead of measuring a buffered string.Should fix tests/od/big-w.sh