Yep, another post with the word ‘latency’ written all over it.
I’ve talked a lot about latency, and how it is more often than not completely immutable. So, if the latency cannot be improved upon because of some pesky law of physics, what can be done to reduce that wasted time? Just three things, actually:
The first option is constantly overlooked – do you really need to be doing this task that makes you wait around? The second option is the classic ‘do things in bigger lumps between the latency’ – making less roundtrips being the classic example. This post is about the third option, which is technically referred to as latency hiding.
Everybody knows what latency hiding is, but most don’t realise it. Here’s a classic example:
I need some salad to go with the chicken I am about to roast. Do I:
(a) go to the supermarket immediately and buy the salad, then worry about cooking the chicken?
(b) get the chicken in the oven right away, then go to the supermarket?
Unless the time required to buy the salad is much longer than the chicken’s cook-time, the answer is always going to be (b), right? That’s latency hiding, also known as Asynchronous Processing. Let’s look at the numbers:
Option (a)=1800s+4800s=6600s (oh man, nearly two hours until dinner!)
Option (b)=4800s (with 1800s supermarket time hidden within it)
Here’s another example: You have a big code compile to do, and an empty stomach to fill. In which order do you execute those tasks? Hit ‘make’, then grab a sandwich, right?