Sunday, August 31, 2008

Optimization

If you re-engineer someone's Perl code from scratch and your version takes 80% less lines, is more maintainable, but runs for twice as long, is it an improvement?

There's two reasons for an affirmative answer: maintainability is key-- especially when you have other engineers coming to you practically every day with different variations to try-- and computing power only increases with time, so runtime is less and less significant. This is essentially the point of Perl, after all.

1 comment:

caleb said...

Turns out that having your regexes compiled, qr//o, greatly speeds up reuse when looping over hash keys. The program now runs in as much (as little) time as the original, so no loss of efficiency.