Skip to content

built-in cp performance issue #14778

@hongxuchen

Description

@hongxuchen

Describe the bug

The built-in cp seems to perform rather badly compared to GNU coreutils cp.

How to reproduce

> timeit ^cp -r cymbol_out/ cymbol_out_bak         
2sec 291ms 42µs 609ns
> timeit ^rm -rf cymbol_out_bak
6ms 38µs 704ns
> timeit cp -r cymbol_out/ cymbol_out_bak
51sec 978ms 794µs 94ns
> timeit rm -rf cymbol_out_bak
62µs 774ns
> ls cymbol_out/
──────────────────────────────────────┬──────┬───────────┬──────────────
                 name                 │ type │   size    │   modified
──────────────────────────────────────┼──────┼───────────┼──────────────
 cymbol_out/GenericClass.json         │ file │   4.8 MiB │ 9 hours ago
 cymbol_out/cymbol_cc.json            │ file │  10.9 MiB │ 10 hours ago
 cymbol_out/Location.json             │ file │ 467.2 MiB │ 9 hours ago
 cymbol_out/FunctionBody.json         │ file │ 181.3 MiB │ 9 hours ago
 cymbol_out/Attribute.json            │ file │ 165.1 MiB │ 9 hours ago
 cymbol_out/Method.json               │ file │ 160.8 MiB │ 9 hours ago
 cymbol_out/Access.json               │ file │ 167.8 MiB │ 9 hours ago
 cymbol_out/infusion_snapshot.json    │ file │     222 B │ 9 hours ago
 cymbol_out/LocalVariable.json        │ file │ 247.4 MiB │ 9 hours ago
 cymbol_out/LocationWithReceiver.json │ file │ 430.5 MiB │ 9 hours ago
 cymbol_out/GlobalFunction.json       │ file │  29.5 MiB │ 9 hours ago
 cymbol_out/Package.json              │ file │   3.2 MiB │ 9 hours ago
 cymbol_out/Call.json                 │ file │ 334.2 MiB │ 9 hours ago
 cymbol_out/Module.json               │ file │  28.8 MiB │ 9 hours ago
 cymbol_out/System.json               │ file │ 217.7 KiB │ 9 hours ago
 cymbol_out/InheritanceRelation.json  │ file │   4.7 MiB │ 9 hours ago
 cymbol_out/GlobalVariable.json       │ file │  12.0 MiB │ 9 hours ago
 cymbol_out/File.json                 │ file │  32.6 MiB │ 9 hours ago
 cymbol_out/Namespace.json            │ file │   1.9 MiB │ 9 hours ago
 cymbol_out/Class.json                │ file │  40.7 MiB │ 9 hours ago
 cymbol_out/Parameter.json            │ file │ 210.2 MiB │ 9 hours ago
 cymbol_out/TypedefDecorator.json     │ file │   6.0 MiB │ 9 hours ago
 cymbol_out/Union.json                │ file │ 110.1 KiB │ 9 hours ago
 cymbol_out/Subsystem.json            │ file │   1.4 MiB │ 9 hours ago
 cymbol_out/Primitive.json            │ file │   2.8 KiB │ 9 hours ago
──────────────────────────────────────┴──────┴───────────┴──────────────

Expected behavior

built-in cp performs comparably with GNU coreutils cp.

Configuration

> version | transpose key value | to md --pretty
| key                | value                                       |
| ------------------ | ------------------------------------------- |
| version            | 0.100.0                                     |
| major              | 0                                           |
| minor              | 100                                         |
| patch              | 0                                           |
| branch             |                                             |
| commit_hash        |                                             |
| build_os           | linux-x86_64                                |
| build_target       | x86_64-unknown-linux-gnu                    |
| rust_version       | rustc 1.84.0-nightly (798fb83f7 2024-10-16) |
| rust_channel       | nightly-x86_64-unknown-linux-gnu            |
| cargo_version      | cargo 1.84.0-nightly (8c30ce536 2024-10-15) |
| build_time         | 2024-12-17 08:59:22 +08:00                  |
| build_rust_channel | release                                     |
| allocator          | mimalloc                                    |
| features           | default, sqlite, trash                      |
| installed_plugins  | gstat 0.100.0, polars 0.100.0               |

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:coreutils-uutilsChanges relating to coreutils/uutilsA:file-systemRelated to commands and core nushell behavior around the file systemcategory:upstreamproblem with upstream dependencyperformanceWork to make nushell quicker and use less resources

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions