in reply to Perl and common subexpressions
Manually perform subexpression elimination in tight loops as often as you practically can. It can make quite a bit of difference in a CPU-bound script. (Remember -- 25% is the difference between an hour and 45 minutes.)Please be very, very carefully with drawing conclusions. You have performed a benchmark, with one specific set of data, using a specific versions of Perl, for a specific version of a certain OS, running on a specific set of hardware. All you have proven so far is that with this particular combination of data, OS, perl version and hardware, you have a 25% gain. For someone else, using a different OS, a different CPU, or a different version of Perl, the numbers might be different.
Note also that a 25% improvement in an very, very simple loop seldomly translates to 25% improvement in the overall program. If only for the fact you'll typically do more in the loop.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl and common subexpressions
by Stevie-O (Friar) on Dec 23, 2004 at 15:13 UTC |