Skip to content

split: write each run of lines to a chunk with a single write - #16357

Merged
sylvestre merged 1 commit into
uutils:mainfrom
eduardomourar:split/lines-single-write
Nov 16, 2026
Merged

sylvestre merged 1 commit into
uutils:mainfrom
eduardomourar:split/lines-single-write

Conversation

@eduardomourar

Copy link
Copy Markdown
Contributor

LineChunkWriter issued one write(2) per line. Since custom_write was replaced by write_all, that per-line overhead grew and split_lines regressed by about 26% on CodSpeed. Like GNU, gather the lines of the read buffer that go to the same chunk and write them at once.

@codspeed

codspeed Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will improve performance by ×3.3

1 warning

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

⚡ 2 improved benchmarks
✅ 8 untouched benchmarks
⏩ 466 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ CPU Simulation split_lines 14.4 ms 4.4 ms ×3.3
⚡ CPU Simulation split_numeric_suffix 14.6 ms 4.6 ms ×3.2

Tip

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


Comparing eduardomourar:split/lines-single-write (a5397a2) with main (b5223da)2

Open in CodSpeed

Footnotes

  1. 466 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. ↩

  2. No successful run was found on main (fca3de1) during the generation of this report, so b5223da was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@eduardomourar
eduardomourar force-pushed the split/lines-single-write branch from 1eababf to f99d0c1 Compare November 14, 2026 20:00
@eduardomourar
eduardomourar marked this pull request as ready for review November 14, 2026 20:02
@eduardomourar
eduardomourar force-pushed the split/lines-single-write branch from f99d0c1 to 9c421ca Compare November 14, 2026 21:56
@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/misc/usage_vs_getopt (fails in this run but passes in the 'main' branch)

Comment thread tests/by-util/test_split.rs Resolved
Comment thread src/uu/split/src/split.rs Resolved
Comment thread src/uu/split/src/split.rs Resolved
@sylvestre

Copy link
Copy Markdown
Contributor

thanks for this PR!
Nothing tests -l when lines and chunks cross read-buffer boundaries, and this change touches exactly that code, see the inline comment.

Comment thread src/uu/split/src/split.rs Resolved
@eduardomourar
eduardomourar force-pushed the split/lines-single-write branch from 608b5fe to a5397a2 Compare November 15, 2026 22:17
@sylvestre
sylvestre enabled auto-merge (rebase) November 15, 2026 22:44
@sylvestre
sylvestre merged commit 3e2c890 into uutils:main Nov 16, 2026
104 checks passed
@eduardomourar
eduardomourar deleted the split/lines-single-write branch November 16, 2026 18:05
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