Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Performance issue in the loop.

by rsFalse (Chaplain)
on Feb 23, 2022 at 07:23 UTC ( [id://11141574]=note: print w/replies, xml ) Need Help??


in reply to Re: Performance issue in the loop.
in thread Performance issue in the loop.

Thanks for suggestions.

I ran your code and it worked a little bit slower than my program (optimized variant).
Also I observed that by few-fold increasing $n, the factor of ~1.5x isn't changing.
P.S. I used v5.30.

Replies are listed 'Best First'.
Re^3: Performance issue in the loop.
by NERDVANA (Deacon) on Feb 23, 2022 at 20:23 UTC
    Ah, nevermind, I realize I was comparing to your old code, not your optimized one. Yes the optimized one gets rid of the double check of $sums$j-$i so that works too.

    Still, List::Util::max is faster than (sort...)[0]

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-19 17:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found