This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: cp to flash drive very slow

> I tried using cp to copy a zip file 106MB from my hard drive 
> to my flash drive (sandisk mini cruzer).  After 20 minutes it 
> still had not completed.
> xcopy copied the file in 22 seconds.
> Why would cp be so much slower?  Any ideas as to work-arounds?

Last I checked, cp was slower on network copies than xcopy was, but the
difference was nowhere *near* that dramatic.  I can offer a few guesses

1.  Again last I looked, cp was using fopen()/fread() et al to do the copy.
Good for portability, bad for efficiency.  Xcopy is probably using
CopyFile{Ex} or some such lower-level funcion, which if MS is on the ball
(yeah I know) involves a lot fewer layers of code, and if we're really good
maybe is even copying raw sectors using scatter/gather (yeah I know I'm
dreaming, but maybe).

2.  Caching.  Xcopy may be caching your writes to flash, cp may be forcing a
flush somehow.  I've had similar copies take essentially no time, only to
find out that the copy never actually got committed to disk until much much
later.  XP SP1 doesn't default to that behavior IIRC, but check to make sure
that you do NOT have that option turned on, or you WILL lose data.

Regardless, <3.7Mb/second seems like something's wrong somewhere.  Are you
running USB2.0 hub-to-device?

Gary R. Van Sickle

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]