The hard disk in your computer, especially if it’s a modern one, is pretty smart. If you (or a program you use) reads a bit of data from disk, it gives it to you as needed but – and that’s the smart part – then continues to “secretly” read a bit more. As humans and programs are predictable, there’s a pretty good chance that you’ll also need this next block of data soon, and then – voilà! It already has it there for you on a silver platter.

The coolest thing about this feature is that, while the disk continues to read more than you initially asked for, you can go on and do other computations, e.g., with the bit of data that you just got. So the two things can happen in parallel. Pretty neat – if you know about this behaviour (called hard disk prefetching – not to be confused with the prefetching from main memory to L2 cache).

If you don’t know about this then you can spend a couple of hours banging your head (or rather mine) trying to understand why Algorithm A (which just reads a large chunk in one slurp) takes more time to read from disk than Algorithm B (which reads the same amount of stuff, but in small chunks with breaks for computations in between).

I wish work in real life was also like that: You start working on something, then stop and do something else and when you later come back the work you initially started has progressed without you.

So, life is like a box of chocolates: You never know what you’re gonna get. – But if you’re lucky it’s already prefetched and you’ll get it faster.