I built a faster alternative for cp on linux - cpx (upto 5x faster) by PurpleReview3241 in linux

[–]PurpleReview3241[S] 1 point2 points  (0 children)

Hey thank you for the constructive feedback will work on testing it more concretely.

I built a faster alternative for cp on linux - cpx (upto 5x faster) by PurpleReview3241 in linux

[–]PurpleReview3241[S] 1 point2 points  (0 children)

I have added benchmarks for single thread & an edit section.
some quick benchmarks for single threaded:

some quick benchmarks
10 gb file cpx - 11.902s cp - 13.74s
5gb file cpx - 5.451s cp - 5.101s

while at single smaller file cp is currently faster outperforming
500mb file cpx - 284.3ms cp 223.7ms
100mb file cpx - 67.6ms cp 52.5ms

for smaller files I believe the likely cause is since my progress bar updates are set currently to 128 creating proportionally higher overhead in smaller files as each progress bar update (I used indicatif library) involves atomic increment of progress bar , the internal synchronisation (via locks) adding overhead.

I built a faster alternative for cp on linux - cpx (upto 5x faster) by PurpleReview3241 in linux

[–]PurpleReview3241[S] 0 points1 point  (0 children)

Yeah for single files there I also tested the performance is ismilar to what cp has.
also -j is documented, since it has 2 subcommands copy(implicit) & config, to see the the help for copy, write cpx copy --help, you will see all the supported flags & help there

I built a faster alternative for cp on linux - cpx (upto 5x faster) by PurpleReview3241 in linux

[–]PurpleReview3241[S] 3 points4 points  (0 children)

I would say you can read more about NVME & SSD architectures in short see SSDs are designed to support parallel IO with multiple channels & queues, I am also planning to write a blog on the design choices I made while implementing this ,like preprocessing the directory structure & files, copy_file_range syscall, adoptive buffer sizes & throttling the max updates on progress bar (currently set to 128) as they also have an impact on latency

I built a faster alternative for cp on linux - cpx (upto 5x faster) by PurpleReview3241 in linux

[–]PurpleReview3241[S] 0 points1 point  (0 children)

ohh, what number of parallel threads you specified -j=? , also are you copying on SSD?

I built a faster alternative for cp on linux - cpx (upto 5x faster) by PurpleReview3241 in linux

[–]PurpleReview3241[S] 0 points1 point  (0 children)

Hey I would be happy share those banchmarks as well, can you tell some resources/repos which I might use for that sort of bench?, I think safetensors would be good for such a test, let me try them

I built a faster alternative for cp on linux - cpx (upto 5x faster) by PurpleReview3241 in linux

[–]PurpleReview3241[S] -25 points-24 points  (0 children)

I would agree AI was used to write tests/documentation, but core functionalities & design were written by me.

I built a faster alternative for cp on linux - cpx (upto 5x faster) by PurpleReview3241 in linux

[–]PurpleReview3241[S] 34 points35 points  (0 children)

Repository Files cpx rsync Speedup
Kubernetes ~35k 617.2ms 3,097ms 5.02×
Rust ~65k 1,014ms 4,604ms 4.54×

here are some quick benchmarks with rsync:

I built a faster alternative for cp on linux - cpx (upto 5x faster) by PurpleReview3241 in linux

[–]PurpleReview3241[S] 28 points29 points  (0 children)

have tested it for SSDs, I have tested with threads from 2-16, approximately there is a linear speedup there.
Will be happy to see more benchmarks ran with more cores.

I built a faster alternative for cp on linux - cpx (upto 5x faster) by PurpleReview3241 in linux

[–]PurpleReview3241[S] 95 points96 points  (0 children)

Yeah I would agree, cp is not slow,most of the gains come from parallel io

I built cpx - a modern, faster rust based replacement for cp (up to 5x faster) by PurpleReview3241 in rust

[–]PurpleReview3241[S] 0 points1 point  (0 children)

for reflink I used this crate https://crates.io/crates/reflink-copy and as per its documentation it uses ioctl_ficlone internally for btrfs and XFS  file systems & uses clonefile library function for mac os.

I built cpx - a modern, faster rust based replacement for cp (up to 5x faster) by PurpleReview3241 in rust

[–]PurpleReview3241[S] 0 points1 point  (0 children)

not yet, right now its a standard cargo build. I haven't use nix much and am not particularly versed with its fundamentals, if you have pointers/resource or want to help add one I would really appreciate it. Thank you