Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Issue on covariance calculation

by rodion (Chaplain)
on Apr 13, 2007 at 08:53 UTC ( #609849=note: print w/replies, xml ) Need Help??


in reply to Issue on covariance calculation

Opening and closing a file is quite time consuming on most operating systems. Your code opens and closes "Outfile.txt" 10,000 times, once for each input line. You also have to find the end of the file each time you open it, which will take quite a while as the file gets large.

Try taking the open and close for that file outside the "for my $element" loop, so it's opened and closed only once. That should speed things up a lot.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2021-09-17 20:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?