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

Re^5: counting backward (optimize foreach reverse low .. high

by LanX (Canon)
on Mar 02, 2013 at 15:52 UTC ( #1021439=note: print w/ replies, xml ) Need Help??


in reply to Re^4: counting backward (optimize foreach reverse low .. high
in thread counting backward

Maybe it's optimized for reversing arrays but not for reversing ranges:

I had to stop the second version because the swapping started to freeze my system:

lanx@nc10-ubuntu:~$ perl -e'for my $i ( 0 .. 1e8 ) { $x*=-1; $x+=$i }; +print "$x\n"' 50000000 lanx@nc10-ubuntu:~$ perl -e'for my $i ( reverse 0 .. 1e8 ) { $x*=-1; $ +x+=$i };print "$x\n"' ^C^C^C lanx@nc10-ubuntu:~$ perl -version This is perl, v5.10.0 built for i486-linux-gnu-thread-multi ...

Reversing ranges was what BUK did, but AnoMonk replied with a reference to a fix for reversing arrays!

Cheers Rolf


Comment on Re^5: counting backward (optimize foreach reverse low .. high
Download Code
Re^6: counting backward (optimize foreach reverse low .. high
by Anonymous Monk on Mar 02, 2013 at 16:24 UTC

    Reversing ranges was what BUK did, but AnoMonk replied with a reference to a fix for reversing arrays!

    As a suggestion to fix range operator

Re^6: counting backward (optimize foreach reverse low .. high
by dave_the_m (Parson) on Mar 02, 2013 at 17:37 UTC
    Maybe it's optimized for reversing arrays but not for reversing ranges:
    But the post of yours which I replied to explicitly showed @a as an example, not a range. I never claimed ranges were optimised, while you implied that arrays weren't.

    Dave.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2015-07-05 03:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls