What if the code is running on far more than 50 machines? If I save 10% on 500 machines or 1% on 5,000 machines, is that worthwhile?
I think Kernighan and Pike came up with the best metric for when to optimize in The Practice of Programming. They say that the time spent optimizing should never outweigh the run time saved through optimization unless you're against a hard deadline the software can't meet.
You might want to weight this for the price of computer time vs. programmer time, so if your programmer's time is worth $50k a year and the computer time spent running the software is $5k a year, don't let them spend more than a man month optimizing. Since the computer will probably get upgraded at some point, make it 2 man weeks. This way, your $2k investment in your programmers pays off the first year and to some extent every year after.
For a program that runs on one machine once in a while, throw hardware at it. For something that's the sole application of a farm of hundreds of servers, you might save tens of of thousands of dollars every year by spending a man week doing the simple, obvious optimizations.
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link
or How to display code and escape characters
are good places to start.