Skip to content

dd takes a really long time to allocate memory with large buffers (tested with 1G) #11544

@hyperair

Description

@hyperair

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 Aloxaf/fzf-tab#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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions