Today I happened to take my laptop to a coffee shop to have some tea and work on an programming project. Usually, my workflow when preparing for a trip like this is:
I have attempted to copy the files via the network, as I do have network sharing turned on, but as they are primarily small files, I found that sneakernet + external drive was considerably faster than WiFi (although how much varied by project). And if I was going to connect my laptop to Ethernet, it really wasn't any more trouble to grab a flash drive. There's no reason to believe Internet-based sharing would be any quicker than intranet, so sneakernet it is.
Today I decided, why bother copying to the laptop's hard drive? Just run it from the flash drive. It would save the copy time, and likely be faster since it's flash-based storage. So that's what I did. However, everything seemed a bit more sluggish, particularly compiling. It worked, yes, but my laptop seemed really slow, and Task Manager didn't show an inordinate amount of CPU activity. So when I got back home, I decided to test compiling my project on both the USB drive, my laptop, and my desktop. This is running "mvn clean install" on it, including running the unit tests on it (which are not a significant amount on this project). The configurations are:
Core i5 520M + Micro Center USB 3.0 32 GB Flash Drive, USB 2.0 Port
Core i5 520M + Hitachi 7200 RPM 250 GB laptop hard drive
Core i5 2500K + Micro Center USB 3.0 32 GB Flash Drive
Core i5 2500K + Toshiba 7200 RPM 2 TB desktop hard drive
Core i5 2500K + Crucial MX100 240 GB SSD
Core i5 2500K + Samsung 850 Evo 1 TB desktop hard drive
Now, common sense would put it in approximately this order, from fastest to slowest:
850 Evo, MX100, Flash Drive + 2500K, Flash Drive + 520M, Toshiba 7200 RPM + 2500K, Hitachi 7200 RPM + 520M
Reasoning that an SSD should beat a flash drive, but especially for small files where the HDD won't be able to take advantage of its sequential access, the flash drive should beat the HDD.
However, here's what I actually saw, taking the best of 3 runs for each setup. The larger times are slower:
The flash drive was far and away the slowest, regardless of which computer it was running on, although the desktop system did considerably better with it. It's also worth noting that the USB setup is not entirely equal. The two systems are:
HP 8740w, Core i5 520M, Chipset-native USB 2.0 chip, Windows XP x86
Custom desktop, Core i5 2500K, Etron USB 3.0 chip, Windows 8.1 x64
I didn't realize until writing this that I had used one of the slower USB 2.0 ports on the laptop without thinking about it, but since it's still much slower on the USB 3.0 port on the desktop, the results remain interesting. The USB flash drive is much slower in all cases.
What could cause it? It could be the drive itself - it's a bargain flash drive, not one renowned for speed. Still, I did expect it to at least be comparable to a hard drive. It could also be the overhead of USB - USB is more CPU-intensive than either local SATA hard drive access or some competing protocols such as FireWire, and perhaps that overhead really added up in this workflow.
Among the other options, they all performed close to equally. On the desktop, the difference between the fastest and slowest drive was about 1/6 of a second, which was not noticeable. This matched what I'd seen previously when testing running my projects off my Toshiba HDD versus my MX100 - I couldn't notice a difference, and the reported times were essentially identical, so I left the projects on the HDD. Here, the MX100 won by a thin margin, and the hard drive actually beat the shiny new Samsung 850 Evo. The 850 Evo is running on a different SATA controller - an add-in Marvell one rather than the native Intel one - but my takeaway here is that the workflow was CPU or RAM-bandwidth limited at this point, not disk limited.
The laptop with the hard drive was slower than the desktop, but not by a huge margin, and this would be expected given the difference in CPU power. This wouldn't really be noticeable for this size of a project, whereas the difference with the USB drive was quite noticeable.
So what did I learn? It's worth the time to copy over to the laptop's hard drive, for one. Next, that I may want to invest in a better flash drive. And third, that while it would be nice for starting programs, once I get my IDE up, I'm not likely to see a noticeable benefit from switching to an SSD in my laptop. Overall, yes, it would be nice, but at least for this workflow the hard drive is just fine.
I'll likely do a follow-up or edit this article with an external hard drive thrown in the mix, to see how it fares on USB, and perhaps also with USB 3.0 on the laptop and USB 2.0 on the desktop. Is is that hardware or USB that's mainly causing the slowdown? I'd like to find out.
Return to Blog Index