xcopy vs. rsync
xcopy vs. rsync, rsync vs. xcopy
Though rsync has capabilities that Win32’s xcopy only dreams of, how do the two stack up when compared apples to apples?
My test: synchronize a large collection of files, between two different local disks. 8.19 GB of data in 11,072 files across 182 directories.
My platform: a Dell Optiplex 740, AMD Athlon 64 X2 Dual Core 5200+, 2.61 GHz, 4GB RAM, Windows XP SP 2, latest updates applied.
I’m running rsync under CygWin, version 2.6.9. That rsync was written for Unix I don’t think handicaps it. But being forced to work through the CygWin DLLs just might. No networking or data compression, as that’s unnecessary here and would only slow it down.
Command lines: xcopy C:TestSrc F:tmpxctest1 /D /E /C /I /Q /H /R /K /O /Y C:SoftwareOpenCygWinbinrsync -q -a -r /cygdrive/c/TestSrc /cygdrive/f/tmp/rstest1
Results:
Building the directory from scratch:
xcopy: 4:59.42
rsync: 6:11.95
Updating one file somewhere in the directories:
xcopy: 1.70 sec
rsync: 2.98 sec
No files to update:
xcopy: 1.33 sec
rsync: 2.22 sec
Updating three files somewhere in the directories:
xcopy: 1.25 sec
rsync: 2.78 sec
These numbers don’t take into account the fact that XP caches the directory entries off the disk the first time they’re referenced. That operation penalizes the first operation (xcopy or rsync) by 10 seconds.
Conclusion: Though xcopy moves data 25% faster than rsync on its native Win32, rsync keeps up in all other respects. In the typical case (for me) where some small subset of files has changed, they’re neck and neck. So using rsync instead of xcopy wouldn’t put me at a performance disadvantage.
Keep in mind that dealing with CygWin’s paths aren’t for the faint of heart.
This is a quick and dirty benchmark. No averaging or further exploration than what you see above, though the numbers seemed consistent across a few runs.
An impressive performance by both rsync and CygWin.
Hope it helps.
[8/18/2008] P.S.: Important: Does your xcopy seem slow? Having it output each file’s name slows it down by orders of magnitude. Use /Q to make it run silently, once you’re convinced it’s doing the right thing.
See also the comments below.