Nigel Hamilton wrote:
Hi,
I've been thinking about ways I can make my Perl modules run faster.
Funny, I was also thinking that. "I know", I thought, "I'll use the perl profiler".
Several core dumps later, I've sort of abandoned the idea.
The profiler was never very robust, but in perl 5.8.0 it seems even less so. Anyone else find this?
Anyway, as for your optimiser, I'd be amazed if the way you handle the argument stack makes that much overall difference. Also, having two versions of functionally identical code strikes me as maintenance unfriendly. That said I'd be interested to see what speed improvements you do get. Personally, I find that almost all code can be accelerated via low level caching. Every time you compute something ask yourself "Can this be cached so the next similar request has no computation overhead?" The wonderful or-cache (or Orcish manoeuvre) is your friend here. Instead of:
$result = compute($argument); # calls compute() function every time
use
$cache{$argument} ||= compute($argument); $result = $cache{$argument};
And so on. I have a hard time getting my Java developers to do this. -- Jonathan Peterson Technical Manager, Unified Ltd, +44 (0)20 7383 6092 [EMAIL PROTECTED]