Skip to content

tail: improve throughput for -c N file#11979

Open
oech3 wants to merge 1 commit intouutils:mainfrom
oech3:tail-non-plus
Open

tail: improve throughput for -c N file#11979
oech3 wants to merge 1 commit intouutils:mainfrom
oech3:tail-non-plus

Conversation

@oech3
Copy link
Copy Markdown
Contributor

@oech3 oech3 commented Apr 24, 2026

Part of #11607 (non-stream)
The code path without + is different.

$ target/debug/tail -c 1PB /tmp/huge | pv>/dev/null
^C.9GiB 0:00:01 [39.9GiB/s]
$ tail -c 1PB /tmp/huge | pv>/dev/null
^C02GiB 0:00:01 [2.02GiB/s]

@oech3
Copy link
Copy Markdown
Contributor Author

oech3 commented Apr 24, 2026

$ truncate -s 48k /tmp/page
$ taskset -c 0 hyperfine -N "target/release/tail -c 48k /tmp/page" "target/release/tail-splice -c 48k /tmp/page"
Benchmark 1: target/release/tail -c 48k /tmp/page
  Time (mean ± σ):       1.4 ms ±   0.2 ms    [User: 0.5 ms, System: 0.8 ms]
  Range (min … max):     1.1 ms …   4.0 ms    1836 runs
 
Benchmark 2: target/release/tail-splice -c 48k /tmp/page
  Time (mean ± σ):       1.3 ms ±   0.2 ms    [User: 0.5 ms, System: 0.7 ms]
  Range (min … max):     1.1 ms …   4.6 ms    1660 runs
 
Summary
  target/release/tail-splice -c 48k /tmp/page ran
    1.01 ± 0.25 times faster than target/release/tail -c 48k /tmp/page

Less than the size is very subtle. 32kib sometimes wins and loses.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 24, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/cut/bounded-memory (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/cut/cut-huge-range is now being skipped but was previously passing.
Note: The gnu test tests/seq/seq-epipe is now being skipped but was previously passing.
Congrats! The gnu test tests/rm/many-dir-entries-vs-OOM is now passing!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 24, 2026

Merging this PR will not alter performance

✅ 309 untouched benchmarks
⏩ 46 skipped benchmarks1


Comparing oech3:tail-non-plus (d6fbfa0) with main (30fd234)

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.

@oech3 oech3 marked this pull request as ready for review April 24, 2026 16:35
@xtqqczze
Copy link
Copy Markdown
Contributor

1.01 ± 0.25 times faster than target/release/tail -c 48k /tmp/page

It's not statistically significant?

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