2006-03-01

On the Merits of Speed

Not the "vroom, vroom" kind of speed, but the "click, whir, oh-look-it's-already-done" kind.

On several occasions here, I have promoted the idea of storing your e-mail in Maildirs, and that you could have exclusive Maildirs for accounts you create.

This has an inherent administrative problem. How do you know which Maildirs have new messages in them? If you put every Maildir you have in your .muttrc file, it will scan them and know which ones have new mail.

But let's say you just want a summary. Say when you login. You authenticate, and the system tells you how many new messages you have and in which Maildirs.

I wrote a Perl script to answer this question a long time ago. When I chose to learn Python I rewrote it in Guido's language and for a long time this was the version I used on my shell accounts. There's no real advantage of one over the other. I think I might have gotten a slightly faster time out of the Python script.

In any case, Perl or Python, each script requires that the respective interpreter be loaded before I can start crunching numbers and counting files.

Wouldn't it be much faster to do the whole thing in C? You bet. C is fast. Really fast. No surprises there, but I look forward to the seconds I'm going to save myself every time I log into a box. Instead of waiting 6.53 seconds on the Python script, I'm waiting 0.5 seconds for the C version.

So every time I login, I save myself 6 seconds. In five days (assuming a mere 2 logins per day), I'll be one minute ahead of myself because of one little program. In a month, I'll have saved as much time as I spent developing the application.

Maybe two months. I don't know for sure, because as fast as it is, C is not a great language for rapidly prototyping or churning out a lot of proof-of-concept code. Either way I'm gonna save so much time it's scary.

No comments: