Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: inefficient code? works on small files ok but not larger ones

by mutated (Monk)
on Oct 05, 2004 at 16:11 UTC ( [id://396642]=note: print w/replies, xml ) Need Help??


in reply to inefficient code? works on small files ok but not larger ones

The code would be easier to read ( and thus easier to comment on and make more efficent ) if you changed a couple things, first try using a little more descriptive names than i,j,k,m,n and o. Also as it doesn't appear that you modify the value of i/j or k/m within the context of one loop just get rid of j and m refer to them instead as (i+5) and (m+5). I think also changing for $R (0..$#ranges) to foreach $range (i,i+5,m,m+5) it wont make your code run any faster, as others have noted above, reading in a 22MB file into an array, and itterating through that array that many times just isn't a good thing, but it's a good place to start.


daN.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-04-20 02:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found