Hardware Performance

ziggy on 2003-08-28T12:06:13

Tim Bray has a nice writeup of a problem he worked on mumble years ago on a Sun3 or Sun4. It involved selecting text using XLib; the task was rather complex, the code lengthy and hard to follow, and Tim was sure it would be dog slow. It wasn't. Actually, it was quite fast.

This leads Tim to the following observation:

Computers are amazingly, remarkably, unbelievably fast. When you’re executing compiled code that’s running around structures in memory (and they actually fit in memory), you can do stupendous quantities of computation with no perceptible delay.

It’s easy to forget that now; there are so many layers of database and application server and virtual machine and interface abstraction and method dispatching getting between our code and the metal that we often convince ourselves that the machines are slow. They’re not; and when you need something to run really really fast, you can always make that happen, if you can push the problem down to traversing in-memory data structures with compiled code.

Of course, often you can’t. This way of thinking about things is currently unfashionable, and in modern programming environments sometimes effectively impossible. But sometimes you need to do what seems impossible, and this is one way.