Don't ask to ask, just ask | |
PerlMonks |
Re: Packages to make perl code go faster?by hawtin (Prior) |
on Feb 15, 2005 at 11:37 UTC ( [id://431117]=note: print w/replies, xml ) | Need Help?? |
There are many things that can slow your script down. As others have said usually 5% of the code consumes 90% of the execution time. The trick is to identify where those key routines are and look at ways to speed them up. I have used tricks like caching results that can have a significant effect:
Is changed to:
I recently had a case where I was using .= to build up a string, converting the routine to pushing strings on to and array and only concatenating at the end of the function reduced memory usage by a factor of 100 and increased speed by a factor of 10 for that one routine. It is not worth hand coding modules in C until you have tried these types of tricks. The extra maintenance cost will swamp the benefit of speed you get.
In Section
Seekers of Perl Wisdom
|
|