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 improve performance by 4.65%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 2 improved benchmarks
✅ 345 untouched benchmarks
⏩ 46 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation du_wide_tree[(5000, 500)] 20.1 ms 19.2 ms +4.71%
Simulation du_max_depth_balanced_tree[(6, 4, 10)] 62.8 ms 60 ms +4.59%

Tip

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


Comparing oech3:splice-discard (8666570) with main (371b24a)

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:

Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/date/resolution (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/misc/write-errors was skipped on 'main' but is now failing.

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