Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I found myself also asking this question based on some feedback I received from a recent question I posted -
converting hex to char. In this string, unpack and printf were presented as options for converting data. To test the performance for each, I did the following:
Results: 01:32:57 01:33:48 (51 seconds) Results: 01:31:56 01:32:50 (54 seconds) In this case, unpack is the clear winner, although the performance difference doesn't become apparent until after 100000 iterations. So, in my opinion, being that TIMTOWTDI, I would look for a performance differential between these methods and opt for the one that requires the least amount of execution time. The second thing I would check to see if any shelling out can be replaced by an available perl function. I recently wrote a program that required that the date/time stamps in a log file be updated. For this, I made the mistake of relying on shelling out
when I should have used
Hope this helps. cheers, -semio In reply to Re: Optimizing existing Perl code (in practise)
by semio
|
|