Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Performance issue in the loop.

by rsFalse (Chaplain)
on Feb 23, 2022 at 07:23 UTC ( #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 (Friar) 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? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2022-08-15 06:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?