http://www.perlmonks.org?node_id=68957


in reply to Fundamental Benchmarks

Without wanting to mention the usual 'benchmark', 'salt', 'pinch of', etc., it's worth noting that you seem to be aiming for implementation optimization rather than algorithmic optimization (although perhaps you have done the algorithmic, and are just currently interested in the implementation).

To be honest, I'm not sure I'd bother - your 'optimizations' are dependent on how a particular perl implements a feature, which isn't necessarily going to be consistent across versions of perl, and what might be fast now might be slow in the future.

As an example, take all those assembly (spit) programmers, who for years have shaved the time off a multiply instruction by barrel-shifting powers of two. Along comes the P4, with no barrel shift, and suddenly their 'optimization' damages performance like you would not believe.

I know it's not a fantastic answer, but don't bother with implementation optimization - read Knuth, improve your algorithms, and attain bliss :)