dd takes a really long time to allocate memory with large buffers (tested with 1G)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Description
Trying to do a non-blocking read with a buffer size of 1G takes 772ms on rust dd, but 3ms on gnudd. That's a massive difference and makes fzf-tab feel very sluggish (see https://github.com/Aloxaf/fzf-tab/issues/549) just by switching from gnu coreutils to uutils.
% time gnudd bs=1G count=1 status=none iflag=nonblock if=/dev/tty of=/dev/null
gnudd: error reading '/dev/tty': Resource temporarily unavailable
gnudd bs=1G count=1 status=none iflag=nonblock if=/dev/tty of=/dev/null 0.00s user 0.00s system 82% cpu 0.003 total
% time dd bs=1G count=1 status=none iflag=nonblock if=/dev/tty of=/dev/null
dd: IO error: Would block
dd bs=1G count=1 status=none iflag=nonblock if=/dev/tty of=/dev/null 0.06s user 0.72s system 99% cpu 0.772 total
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 with the dd command entry point and reproduce the reported non-blocking read using a 1G buffer and the provided shell commands. Trace where the large buffer is allocated, compare the behavior with gnudd, and consider the issue done when the Rust implementation no longer incurs the reported allocation delay while preserving the command's non-blocking behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, performance
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100