Ubuntu – Why it is over half slower to cp a file instead of using Nautilus’s GUI copy? (AFC protocol)

nautilus

I have an jailbroken iPod Touch, and I have the afc2add package. When I plug it into my ubuntu laptop, it automounts my iPod's Media directory, as well as the app file sharing folders too. When I use Nautilus to transfer a file into the Media folder, it peaks at about 5MB/s. However, when I use a terminal to copy a file to the ~/.gvfs/Matt's iPod folder [In Nautilus, it shows up as "Matt's iPod"], I have only seen it go up to about 2MB/s.

Can anyone give any clues as to why it is over half slower to cp a file instead of using Nautilus's GUI copy?

By the way, the I can tell how fast it is going with a terminal copy, I have a script with pv [In a nutshell, it is: pv $1 > $2], and that was going about 1.5MB/s. So I also tried cp, and set up a loop to du the file every second, and it jumped up somewhere near 2 MB every second.

Best Answer

Nautilus would be going through fewer layers of indirection, which could account for the difference.

Nautilus is a native gvfs application, so it communicates with the gvfs backends directly.

In contrast, cp is talking to the kernel via a FUSE file system mounted at ~/.gvfs, which is handled by the gvfs-fuse-daemon process, which in turn talks to the gvfs backends. Impedance mismatches between the POSIX API and gvfs might account for the less efficient transfers.

You might be able to get similar performance on the command line using the gvfs-copy command from the gvfs-bin package, copying to the appropriate URL.