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:

Plastic box with shoes and ziplock bag.

Suitcase.

Plastic box with MacBook.

Briefcase.

That way, when I cleared the metal detector, I could perform the following operations in this order:

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.

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.

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.

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 ;-)

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.