Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Optimizing perl code performance

by MidLifeXis (Monsignor)
on Aug 14, 2015 at 17:57 UTC ( #1138620=note: print w/replies, xml ) Need Help??

in reply to Optimizing perl code performance

Remove the processing and replace it with just a print DATAOUT $line;. Time this. See how much time is actually spent in the processing part of this. I would guess that the largest part of your time is spent doing I/O, especially if $infile and $outfile are on the same data path (controller, disk, ...).

Once you show that a significant portion of time is spent in the processing, and that splitting the work will help, _then_ perhaps you _might_ gain value from splitting the processing apart into multiple workers. Personally, I would guess from experience that you will get better performance gains by putting your input and output files on different data paths.


Replies are listed 'Best First'.
Re^2: Optimizing perl code performance
by BillKSmith (Prior) on Aug 15, 2015 at 01:03 UTC
    The standard advice for optimizing any code is to profile it, and then optimize only those parts which are shown to consume a large part of the processing time. In this case, MidLifeXis's suggestion accomplishes much the same thing with much less work.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1138620]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2020-11-29 20:46 GMT
Find Nodes?
    Voting Booth?

    No recent polls found