Why is scp with compression slower than without?

Quoting man ssh (which is the base used by scp):

Compression is desirable on modem lines and other slow connections, but will only slow down things on fast networks.

The problem is that compressing the data takes more time then just sending it over the network.


Also, on top of compression, nc gets the best rate because it doesn't encrypt, either. And non-lossy compression relies on finding redundant sections of the data, which when done at the network level you can look at a maximum of [buffer-size] bytes where when done with the entire file first, it's [file-size] bytes within which to hunt and crunch duplicate byte sentences.

Also for moving disk images you should use a filesystem-aware tool like ntfsclone/partclone because even compression can't beat just plain skipping the unallocated blocks - your transfer rate is infinite if you don't have to transfer any data. Also don't forget to destroy the swap and hibernation files on a windows partition or you're copying junk it will just throw away and recreate anyway.