harriyott.com

Lines of code != running time

I've just realised I do a bizarre thing in my subconscious when I'm coding. Now I'm all .NET 3.5, I've been writing code like:

feeds.ForEach(f => ProcessFeed(f));

One line of code instead of the usual four (OK, so two lines were the curly brackets) to write a foreach loop.

Now the thing is, I've unwittingly felt like the code now runs faster because the method is shorter. Of course that isn't true, but having nicer, shorter, eleganter, maintainabler code feels like it should be more efficient too.
22 February 2008