Skip to content

cp performance issue #7092

@hongxuchen

Description

@hongxuchen

As is observed in nushell/nushell#14778, uu_cp seems to have performance issues when dealing with large directories.

> timeit ~/.cargo/bin/coreutils cp cymbol_out/ -r cymbol_out_bak
52sec 95ms 4µs 960ns
> timeit ~/.cargo/bin/coreutils rm -rf cymbol_out_bak
10ms 929µs 36ns
> ~/.cargo/bin/coreutils -h
coreutils 0.0.28 (multi-call binary)
...

In my case, the directory is of ~2.5GB containing a list of big json files. GNU coreutils cp takes <3s to complete the operation but uu_cp takes ~50s. I've also tried on zsh with similar results.

> time ~/.cargo/bin/coreutils cp cymbol_out -r cymbol_out_bak
real    50.43s
user    0.00s
sys     3.23s
> time ~/.cargo/bin/coreutils rm -r cymbol_out_bak
real    0.56s
user    0.00s
sys     0.56s
> time cp cymbol_out -r cymbol_out_bak
real    2.81s
user    0.00s
sys     2.81s
> time rm -r cymbol_out_bak
real    0.54s
user    0.00s
sys     0.54s

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions