uutils / uutils/coreutils

head -c -1 is much slower than head -c 1PB with splice()'ed input

Open
#11,971 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.