Programming Efficiency, Elegance, and Performance

12.05.06 | Comment?

In my post the other day on importing XML as .NET objects, I alluded to my philosophy on programming elegance and performance without ever really going into it.

When writing a program, I always choose efficiency and elegance over performance. To me, efficiency means completing a task in the fewest steps possible, not always in the quickest way, whereas elegance usually means finding a clever solution that also seems completely obvious when you see it.

But code that is efficient and/or excellent does not always perform well. It’s very simple to convert an object to XML using serialization, then load that XML into a DataSet, but there’s a lot going on under the hood, and those extra steps in the background may cause this to take more time to run than simple BFI.

In these cases I always rely on the “Let Bill do it!” technique. Put simply, I rely on the developers of Visual Basic and the .NET framework to be smarter and more experienced than I am, and especially better at squeezing a few more ounces of performance from their code.

(Yeah, I use Visual Basic, and have for years. With most of the work shifted to .NET, I don’t think this is much of a bottleneck anymore.)

So whenever I can, I go for the simplest method and let Microsoft do the work. It makes my code easier to read and maintain without much of a performance hit. And I let Moore’s Law inflate away whatever hit there is. After all, you can always buy a faster processor tomorrow.

have your say

Add your comment below, or trackback from your own site. Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>