I cringe every time I read one of these nodes. In 99% of the cases, CPU cycles simply don't matter, and here's why:
- You're using Perl because it's at that sweet spot between simple and expressive. Which means that you spend less time coding and more time . . . well, you spend less time coding.
- More importantly, changes to your Perl code will, in general, take less time than with any other language and your changes will be safer.
- CPUs double in speed every 18 months while the cost drops by half (Moore's Law).
- The ability to write code, unfortunately, is subject to an inverse Moore's Law.
Let that sink in. A new machine costs about two weeks of your time. Or, put another way, you are worth about 50 machines per year.
Anything you do needs to be measured in that light by the person paying you. Is it worth having my person spend 3 days here and 2 days there squeezing out performance? Or, is it worth just buying another machine and having my person actually spend time advancing my business? Because, there's an additional opportunity cost to squeezing performance cause you're not doing something else that actually makes money.
So, to recap - CPU cycles don't matter because the limiter isn't the CPU anymore - it's the programmer. Especially in a language like Perl.
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?