By Werner Ruotsalainen on Thu, 07/21/2011
UPDATE (07/23 night): I've re-run the iTunes File Sharing test with the just-released iOS5.0b4 (beta 4 of the forthcoming iOS 5) running on both iPad 1 and 2 (without jailbreaking, enabling iCloud or even installing more than one app on the devices).
Interestingly, the iPad 1 turned out to be somewhat faster than the iPad 2: it transferred the 1.8Gbyte TS file in 73 seconds (resulting in about 25 Mbyte / s, which is pretty close to the maximum practical throughput of USB 2.0), as opposed to the 84 seconds of the iPad 2. So was my other A4-based iDevice, the iPhone 4 and the iPod touch 4G, transferring the file in 77 and 126 (=14.5 Mbyte/s; as you can see, while the iPt4G does have an A4 clocked at 1 GHz, it seems to have a lower-quality, that is, slower storage chip) seconds, respectively. However, the older-generation iPhones and iPod touches remained approximately at the same speed (for example, the 4.2.1 iPhone 3GS: 148s; that is, still 12.3Mbyte/s; the 4.2.1 iPT 2G: 158s; that is, 11.5 Mbyte/s)
The latter figure is somewhat larger than the same (iOS5.0b4) iTunes transferring a file to an iPad 2 still running on 4.3.3 (79s [that is, about 22 Mbyte/s transfer speed], which is almost the same as was with previous, pre-iOS5.0b4 iTunes versions).
File transfer over Wi-Fi, as one might guess, is very-very slow; the test file was delivered in about 15 minutes through my Linksys WRT54G. Now, there may be better-optimized setups; for example, true(!) 802.11n (the one running at 5 GHz) with the maximal throughput speed of 300 Mbps – dedicated thread HERE. With a non-n network, however, I don't think you'll encounter better speeds.
Unfortunately, while the new, native Wi-Fi sync is way better than the previous jailbreak-only and commercial ($10) solution, Wi-Fi Sync (dedicated homepage), the latter still does one thing considerably better: remote Xcode app deployment and, even more importantly, debugging. This is simply not working with Apple's solution, not even as of iOS5.0b4. I really hope Apple, some time, does enable wireless debugging.
Note that when I tested Wi-Fi Sync a bit more than a year ago, it was very slow and really unreliable when used together with Xcode. I don't know whether newer versions, running on newer hardware, are any better. Give it a try to find out – after all, it has a trial version.
Original article (07/22) follows:
In a recent article, I've shown two ways of transferring a full directory structure to GoodReader, probably the best PDF reader on the iOS platform.
For my forthcoming, full article on accessing the file system of iDevices (iPads, iPhones etc.), I've run some benchmarks to measure the speed difference between the different ways of file transfer. The differences are pretty staggering, as you'll see.
First, if the given app supports File Sharing through iTunes, use it. It's by far the fastest – about five times(!) faster than the next-fastest method, the one employed by Phone Disk (and other, similar apps). Other, official, AppStore- and Apple-friendly means of file transfer (built-in FTP and HTTP servers) are considerably slower. Finally, the slowest of all is OpenSSH on jailbroken iDevices.
Let's take a look at the benchmarks. All the test have been conducted using a (jailbroken via jailbreakme.com) iPad 2 running 4.3.3 (without any background tasks running, custom Winterboard themes, SBSettings or similar hacks). The desktop computer was a late 2009 2.8 GHz C2D 17” MBP running 10.6.8. (Will soon re-test everything under 10.7 Lion.)
The benchmark results of uploading a 65M file:
File Sharing through iTunes (10.5b48 released for iOS5b3; note that I'll repeat the test with the just-released, fully 64-bit 10.4 as soon as I update my OS to OS X 10.7 Lion): 00:02 (min:sec) (for a 1.83GB file, 01:20; that is, about 22 Mbyte/s)
The latest (1.862) Phone Disk (commercial licensed version): 00:11 (for a 1.83GB file, 04:39; that is, about 6.5 Mbyte/s)
HTTP and FTP server-based apps:
GoodReader (simply tap the networking icon [the second from the left in the bottom right]): 45s (HTTP); that is, about 1.51 Mbyte/s
GoodPlayer: 45s (both HTTP and FTP)
AVPlayer HD: 45s (both HTTP and FTP)
(More on the built-in server of these apps later!)
So far, I've only discussed the non-jailbroken case. If you jailbreak your iDevice, you can install server daemons always working in the background, offering you the chance to always accessing the file system without having to run a specific app.
I've tested the following apps:
vsftpd (current version: 2.0.7; make sure you create a directory named 'empty' under usr/share first; use the root as login credentials. FTP daemon will only start after a restart and will run until you uninstall it or disable via SBSetting, if installed): tested with both Total Commander 7.55b3 under Parallels 6 and CyberDuck 4.0.2 under OS X; the results are 45s / 60s, respectively. Note that you can change the file attributes via FTP too (not only SFTP / OpenSSH!); both FTP above-mentioned clients passed this test.
OpenSSH 5.8p1-9: 71s (CyberDuck 4.0.2 under OS X).
That is, neither of these daemons offer any kind of speed advantage over the HTTP (and, with GoodPlayer, also FTP) upload. On the contrary, OpenSSH has proved to be the slowest of all.
I've also tested the built-in Web server of iFile (1.6.0-1). It was slightly faster than the built-in Web server of the AppStore apps (39s for the 68M test file on the iPad2; that is, 1.74 Mbyte/s) but still not in the same ballpark as even Phone Disk, let alone iTunes File Sharing.
All in all, whenever transfer speed is important, your order of preference should be the following:
- iTunes File Sharing (or other kind of synchronization – don't forget media synchronization is, generally, at least as good [and in several cases, even better] as those of third-party apps) both USB and, of course, iTunes required. (Note that, still being in beta, I haven't tested the transfer speed of the new Wi-Fi synching capabilities of iOS 5.) You can do tricks like ZIPping up an entire directory before dropping the ZIP file to iTunes with some apps (e.g., GoodReader) that do support unzipping even huge files. (See the update HERE for a video of doing this.)
- Phone Disk or similar direct file system accessor tools (even for non-jailbroken devices); both USB and iTunes required
- built-in FTP / HTTP servers accessible via Wi-Fi (no USB or even iTunes required)
- if you jailbreak your phone, system-level daemons accessible over Wi-Fi, without iTunes and without starting any app (try preferring vsftpd to OpenSSH as it's a bit faster!)
Note that, currently, the fastest iDevice is the iPad 2. Older, slower devices are even slower via all methods of access. For example, the USB transfer rate of the iPhone 3GS is 13Mbyte/s, the iPod touch 2G is 8.6Mbyte/s, while that of the iPad2 is 22 Mbyte/s. (I couldn't test the [after the first-generation, 400 MHz iPod touch, second-] slowest iPhone 3G as I want to keep it on 3.1.3 for compatibility testing purposes and iOS versions before 3.2 don't support File Sharing. Phone Disk transferred the file at around 3 Mbyte/s to the 3.1.3-based 3G; that is, slightly more than two times slower than to the fastest iPad2.) Wi-Fi transfers with slower iDevice models are also somewhat slower than on the iPad2 (around 700-900 kbyte/s).
I'm working on a great programmers' article on the socket programming of iOS. As a teacher of iOS programming, I know it's probably the hardest area of iOS programming for people that, otherwise, have no problems with iOS programming. (Neither was it easy for me at first, I must confess.)
I'll provide you with tons of great and easy-to-understand code – including even a working(!) uploader client code for the new version of cocoahttpserver, of which the previous version, iPhoneHTTPServer3, is used by all the three AppStore apps I've benchmarked.
This also means I'll also provide answers to the (still unsolved) questions / problems like THIS and THIS.