3

I accidentally stumbled upon this issue:

Copying a 119 MB zip file took 4 times longer in Terminal (cp) than in Finder!

I copied a file of 119 MB size in Terminal with time cp file.zip file2.zip and it took about 20 seconds.

As this seemed quite slow to me, I went to the Finder, selected the same file and hit Cmd-D (duplicate) and it took less than 5 seconds to create the copy, that is only 25% of the time it took with cp!

Is there an explanation for it - might this be systematic?

Used Hard-/Software

  • MacBook 13" white (2007)
  • OS X 10.6.8
  • Internal hard disk WDC WD10JPVT-00A1YT0

it really seems to be a cache issue: I tried the opposite order with another file and copied it first in Finder and then in Terminal, and in this case also the second copying was much faster.

  • 2
    One single data point is probably not enough here, maybe the cp in Terminal loaded the file into the drive cache (or OS X' file buffer) so the Finder copy didn't have to reread the file. Can you run some additional tests and also change the order (copy with Finder first, with Terminal afterwards)? – nohillside Feb 28 '15 at 8:47
  • @patrix: thanks for your comment - this seems to be a cache issue. I tried with another file in Finder first and then in Terminal and as expected the second one was faster. – MostlyHarmless Mar 1 '15 at 5:34
4

Since I have a much newer system, I couldn't accurately test with a 119 MB file as it took less than a second to copy in Terminal. So I created several much larger files, up to 2 GB, using dd and /dev/random as the source and made duplicates. I then rebooted and then did timed copies of each of the sets, one in Terminal and the other in Finder. This way, there was nothing in the disk cache/memory during the subsequent copy operations in each app for each set.

The timings were near identical, so near as to be the same for this test purpose. I say near identical as in Terminal I used the time command and in Finder I used the second hand of the clock. So in your case, the file definitely was still in memory when the second copy operation was performed.

|improve this answer|||||
  • thanks for trying it out! Indeed it seemed to be a cache issue (see my edit). – MostlyHarmless Mar 1 '15 at 5:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .