Sunday, November 8, 2009

Latency Hiding

A few weeks ago, James Morle posted an article called "Latency hiding for fun and profit." Latency hiding one of the fundamental skills that, I believe, distinguishes the people who are Really On The Ball from the people who Just Don't Get It.

Last night, I was calling to my 12-year old boy Alex to come look at something I wanted him to see my computer. At the same time, his mom was reminding him to hurry up if he wanted something to eat, because he only had five minutes before he had to head up to his bedroom. "Alex, come here," I told him, putting a little extra pressure on him. "Just a second, Dad." I looked up and notice that he was unwrapping his ready-made ham and cheese sandwich that he had gotten out of the freezer. He dropped it into the microwave and initiated its two-minute ride, and then he came over to spend two minutes looking at my computer with me while his sandwich cooked. Latency hiding. Excellent.

James's blog helped me put a name to a game that I realize that I play very, very often. Today, I realized that I play the latency hiding game every time I go through an airport security checkpoint. How you lay your stuff on the X-ray machine conveyor belt determines how long you're going to spend getting your stuff off on the other side. So, while I'm queued for the X-ray, I figure out how to optimize my exit once I get through to the other side.

When I travel every week, I don't really have to think too much about it; I just do the same thing I did a few days ago. When I haven't been through an airport for a while, I go through it all in my mind a little more carefully. And of course, airport rules change regularly, which adds a little spice to the analysis. Some airports require me to carry my boarding pass through the metal detector; others don't. Some airports let me keep my shoes on. Some airports let me keep my computer in my briefcase.

Today, the rules were:
  • I had my briefcase and my carry-on suitcase.
  • Boarding pass can go back into the briefcase.
  • Shoes off.
  • 1-quart ziplock back of liquids and gels: out.
  • MacBook: out.
Here's how I put my things onto the belt, optimized for latency hiding. I grabbed two plastic boxes and loaded the belt this way:
  1. Plastic box with shoes and ziplock bag.
  2. Suitcase.
  3. Plastic box with MacBook.
  4. Briefcase.
That way, when I cleared the metal detector, I could perform the following operations in this order:
  1. Box with shoes and ziplock bag arrive.
  2. Put my shoes on.
  3. Take the ziplock bag out of the plastic box.
  4. Suitcase arrives.
  5. Put the ziplock bag back into my suitcase.
  6. Box with MacBook arrives.
  7. Take my MacBook out.
  8. Stack the two boxes for the attendant.
  9. Briefcase arrives.
  10. Put the MacBook into the briefcase.
  11. Get the heck out of the way.
Latency hiding helps me exit a slightly uncomfortable experience a little more quickly, and it helps me cope with time spent queueing—a process that's difficult to enjoy—for a process that's itself difficult to enjoy.

I don't know what a lot of the other people in line are thinking while they're standing there for their 15 minutes, watching 30 people ahead of them go through the same process they'll soon endure, 30 identical times. Maybe it's finances or football or cancer or just their own discomfort from being in unusual surroundings. For me, it's usually latency hiding.


PdV said...

Laughing at your maniac-routine, but Spot On. I use a similar script.

I add one item: Throw the wallet in the basket at the last moment. Ideally, wallet + me go through screening at the exact same time and I minimize the chance of loosing it or getting it nicked.

Wish they'd standardize the rules: shoes y/n ? boardingpass y/n, wallet y/n ?
Awkward if you are the only one undoing the shoes (not to mention the smell).

Unknown said...

Laughing at your maniac-routine, but Spot On. I use a similar script.

Yep, me too ;-)

Brian Tkatch said...


I would have though to get the suitcase before the bag so it can be opened while the bag was coming.

A space issue?

Cary Millsap said...

Brian, I've done it both ways. I've settled in on the ziplock-before-suitcase order, because the suitcase has a side pocket that I leave open as it goes through the detector. So it's a drop-in operation if the ziplock bag is already in-hand. Plus, I can put the ziplock in the box with the shoes, but I've been admonished not to put the ziplock in the same box with the laptop.

PdV, I put the wallet into a closed, zipped compartment in my suitcase, well in advance of queueing, to minimize the chance that I'll leave it behind or accidentally drop something out of it while I'm under the pressure of people waiting behind me. I prefer to manipulate the wallet in the peace and quiet of a place where I can sit down, away from the crowd.

Doug, surprise there. ;-) No surprise.

Brian Tkatch said...

Cary, you really are ahead of the game.

I worked on similar optimizations. Such as undoing the seatbelt, pulling the car brake, opening the car door, locking the door, turning towards the apartment, and shutting the door, while maximizing the use of both hands.

I also have two pair of shoes i switch between. The shoes not worn get a shoe tree. In order to figure out if i switched the shoe tree the night before (so i don't wear the same pair two days in a row) i have a system. The treed shoes point north (towards the closet), worn, unswitched shoes point east, switched unworn shoes (ready for the next day) point west. This is a very easy system.

I challenged myself once to come up with a system that would tell me what action i was doing while switching the shoes too (should i get up and do something else during those few seconds). I came up with something and did it a few times, but then got bored of it. It had little to do with efficiency, so i didn't care that much about it.

Yet Another Mother Runner said...

It's funny to read this post - the timing of it...
I heard the EXACT same (I mean... almost verbatim) analogy at a Presentation on Instrumentation this Tuesday!!
The presenter also talked about your ILO package :)
I'm guessing she has your Posts on her RSS feed ;-)

Kerry Osborne said...

Ha. Great post.

I usually spend my time planning how to avoid getting strip searched. The order I put my bags on the conveyor can save a couple of seconds, but not getting "special attention" from the security guys can save hours. So I spend most of my time while in the queue repetitively patting every pocket I can find to make sure no metal containing objects are left anywhere on my person. And every once in awhile, I check out the security personnel and try to determine which one looks like they had a bad day. I try to avoid the line that guy's working.

Of course, I'm a little more likely to get "special attention" than most people. Actually, it's my traveling companions that tend to get the attention. Must be something they teach security people -

"Rule #15: The guy with the long hair rarely carries his own contraband. His traveling companion(s) on the other hand should be closely monitored."

I've had frequent traveling companions refuse to go through customs with me for that reason.


Unknown said...

This is hilarious. I tend to do similar things trough the day as well.

For example, I would group knives, forks and spoons together in the dish-washer, so when you take them out you just grab a pile and put it directly into their specific compartment.