The Lair

Do not meddle in the affairs of dragons, for you are crunchy and taste good with ketchup

weird logic

The axiom that computing seems to live by, at least in this neck of the woods, is that hardware is fast, software is slow. Not an unreasonable axiom, when it comes to that. Hardware is extremely fast at pretty much everything, but it’s also expensive to produce. Doing something cheaply in hardware requires economies of scale, mass production till it hits a price point comparable with software.

Confused yet ? As we know, there are known knowns. There are things we know we know. We also know there are known unknowns. That is to say things we know we don’t know. But there are also unknown unknowns, the ones we don’t know we don’t know. Yes, that’s a famous Donald Rumsfeld quote and I trust it made things much clearer.

One of the biggest surprise discoveries that I made this week is that doing something in hardware doesn’t necessarily imply speed. Like the merits of RedBull, there is more imagery in the advertising than might be found in real life. For the purposes of some research (tangentially relevant to what I’m doing, but I’m always up for some dabbling in a new area), we performed a straight shootout between Lucene and a custom indexer written in VHDL. We knew (or thought) that even with the constraints of VHDL, a simulator environment and a drastically slow clock speed, the hardware version would slaughter the software indexer. Oh, and this is Java, so cue the mockery. (It might be worth noting that this particular piece of software outperforms some widely available C implementations)

As my telegraphed buildup would have doubtless tipped off the more astute among you, the hardware version lost. Not by much, but it still lost. Now, in the world where I come from, calling this a loss for hardware would be harsh. The hardware version was running on a 66Mhz processor. Yes, that’s just two digits. The software was running on a 1.4Ghz processor. All other things being equal (and they were, more or less), it would seem that the hardware was labouring under a massive clock cycle disadvantage. And to have come within 30-40 milliseconds of matching the software ? Phenomenal. But by the arcane rules of the hardware expert, it’s a loss. Back to the drawing board, said he. Off he went, muttering mock curses at smart professional software developers and their silly optimized code.

Actually, I was going to give the ending of this story too… but again, I think most of you can already guess. Clearly, writing a mystery novel or a whodunit isn’t a good career option for me. It was all to do with the width of the average word size. Halve that, and the hardware version has far fewer lookups - and thus performs about twice as fast.

What was my takehome message from all this ? How about “It’s not the size of the chip that matters, it’s the width of the bus“. Yes, that sounds about right. I do innuendo, badly.

Just say it

*Required
*Required (This site supports gravatars)