Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re^4: Optimizing a double loop

by roibrodo (Sexton)
on Jun 03, 2010 at 12:51 UTC ( #842908=note: print w/replies, xml ) Need Help??

in reply to Re^3: Optimizing a double loop
in thread Optimizing a double loop

I'll give it a try. BTW, I will also need to sort the array (by abs values) now.

UPDATE: There's no real to use $full[$_] += $count; instead of $full[$_] = $count;, is there? we can therefore also drop the initialization of @full, can't we?

Replies are listed 'Best First'.
Re^5: Optimizing a double loop
by moritz (Cardinal) on Jun 03, 2010 at 14:02 UTC
    You're right on both accounts.

    I just used += because from reading your initial question I wasn't sure if you needed absolute values, or add them to an existing array.

      Thanks! Your suggestion proved to be a brilliant idea.
      I got a five-fold improvement in running time!
      Thanks so much! (and sorry for all the exclamation points, I'm just excited!)
        I got a five-fold improvement in running time!

        How long are your runs taking now?

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2021-10-26 09:54 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (90 votes). Check out past polls.