Skip to content

od: improve perf for --skip-bytes non-seekable input by splice(2) - #13748

Open
oech3 wants to merge 1 commit into
uutils:mainfrom
oech3:splice-discard
Open

od: improve perf for --skip-bytes non-seekable input by splice(2)#13748
oech3 wants to merge 1 commit into
uutils:mainfrom
oech3:splice-discard

Conversation

@oech3

@oech3 oech3 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Closes #12598
This PR adds splice fast-path for --skip-bytes for non-seekable input as same as wc -c.

> truncate -s 1GB /tmp/huge
> time cat /tmp/huge|target/release/od-splice --skip-bytes 1GB
7346545000

________________________________________________________
Executed in   17.97 millis    fish           external
   usr time    0.95 millis    0.00 millis    0.95 millis
   sys time   31.25 millis    3.02 millis   28.23 millis

> time cat /tmp/huge|target/release/od --skip-bytes 1GB
7346545000

________________________________________________________
Executed in  160.61 millis    fish           external
   usr time  109.92 millis    0.89 millis  109.03 millis
   sys time  181.50 millis    2.76 millis  178.73 millis
> hyperfine "cat /tmp/huge|target/release/od --skip-bytes 1GB" "cat /tmp/huge|target/release/od-splice --skip-bytes 1GB" 
Benchmark 1: cat /tmp/huge|target/release/od --skip-bytes 1GB
  Time (mean ± σ):     155.4 ms ±  26.3 ms    [User: 105.1 ms, System: 183.9 ms]
  Range (min … max):   141.6 ms … 260.3 ms    20 runs
 
Benchmark 2: cat /tmp/huge|target/release/od-splice --skip-bytes 1GB
  Time (mean ± σ):      18.9 ms ±   6.1 ms    [User: 3.6 ms, System: 27.3 ms]
  Range (min … max):    15.5 ms …  68.1 ms    154 runs
 
Summary
  cat /tmp/huge|target/release/od-splice --skip-bytes 1GB ran
    8.24 ± 3.00 times faster than cat /tmp/huge|target/release/od --skip-bytes 1GB

@codspeed-hq

codspeed-hq Bot commented Aug 5, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 347 untouched benchmarks
⏩ 46 skipped benchmarks1


Comparing oech3:splice-discard (b170008) with main (ab34a45)

Open in CodSpeed

Footnotes

  1. 46 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.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/cp/parent-perm-race. tests/cp/parent-perm-race is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/cp/sparse-to-pipe. tests/cp/sparse-to-pipe is passing on 'main'. Maybe you have to rebase?
Skipping an intermittent issue tests/tail/retry (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/basenc/bounded-memory is now being skipped but was previously passing.
Note: The gnu test tests/rm/many-dir-entries-vs-OOM is now being skipped but was previously passing.
Congrats! The gnu test tests/cut/cut-huge-range is now passing!

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

Binary size comparison:

Individual binary size comparison VS main (threshold: >=5% AND >=4 KB).

Total size of compared binaries: 148.56 MB (+968 KB, +0.64%)

Significant per-binary changes:
  ls         2.11 MB ->    3.25 MB  (+1.14 MB, +54.36%)
  mkfifo     1.16 MB ->    1.08 MB  (-76 KB, -6.42%)
  mknod      1.16 MB ->    1.09 MB  (-76 KB, -6.38%)
  mkdir      1.16 MB ->    1.09 MB  (-72 KB, -6.04%)

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.

od: --skip-bytes 's performance can be improved by splice

1 participant