head -c -1 is much slower than head -c 1PB with splice()'ed input
Open
Nobody has claimed this yet.
U - head
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Description
$ truncate -s 9PB /tmp/huge
$ cat /tmp/huge | head -c -1 | pv>/dev/null
^C58GiB 0:00:03 [2.88GiB/s]
$ cat /tmp/huge | head -c 1PB | pv>/dev/null
^C07GiB 0:00:03 [37.5GiB/s]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two commands in the issue and compare the head -c -1 and head -c 1PB paths when input is provided through splice(). Trace the head implementation and its handling of negative byte counts; done means the negative-count case no longer has the reported throughput gap without changing its output semantics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100