rentzsch.com: tales from the red shed

The Beauty of Linear Search

Notes

I used to go crazy trying to file physical files under the “right” categories. I’d struggle to think of descriptive-but-short names I could write on folder tabs. Would I remember what this was about four years from now?

Noticing my actual usage patterns, I tried a different system a couple years ago.

(I’m always trying out wacky new systems, but I don’t talk about them until I’ve used them for a while to make sure they work for the long haul. I’m like a time-delayed Merlin Mann (that’s so true in more than one way). This also means that I don’t tend to write about the ones that work, since by the time I’m sure they work, they’ve become routine and no longer interesting to write about.)

My new(-ish) system of filing: no filing at all. Well, that’s not true. I file by date. 12 folders for each year, and archive them at the end of the year.

I don’t try to organize by topic anymore. I found the ROI stinks. On the rare occasions I need to actually dig up something, I usually remember the date well enough (or have enough supporting timestamped digital artifacts) that I can narrow it down to a month or two. Then I linear search. My folders aren’t bulging (I try to keep everything digital that I possibly can, often scanning in papers so I can throw away the original) so the search only takes a couple of minutes.

There are a couple of exceptions. First: bank statements. They get their own folder. They’re the one type of mail that I always will need to retrieve+process later. So those don’t enter the 0(n) system at all, they’re kept handy in their 0(1) folder.

The second is tax flyers. The state+fed loves to send you important-looking letters stuffed with 15-page forms and mini-magazines telling you what to fill out, when to send them in, and how your various typos will extend your prison sentence. Those go into an “accountant” folder as they accumulate, and I take them with me on my next visit. That’s when she flips through the pile and throws them all away.

I love division of labor.

The programming connection: it’s laughingly common to deploy a btree or hashtable to handle a collection when a simple array is faster in practice. Part of the joke is that you’ll probably never notice the array is faster since the collection sizes tend to be so small that the run time is insignificant. Sure the hashtable may be 3000% slower that the array, but with a dozen items it’s only the difference of 200 milliseconds.

You only tend to notice the poor performance of complex collections types when they’re used in loops. That’s when their percentage performance differences over simple arrays tends to be magnified to the point were switching to an array will make a real run time performance difference.

Wow, this entry is rambling, going from filing insights to collection-class selection strategy. But here’s the point I’m trying to make: corn on the cob is good, isn’t it?

Thursday, May 25, 2006
12:00 AM