Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Autogenerate descending arrays

by bl0rf (Pilgrim)
on Mar 14, 2004 at 21:52 UTC ( #336544=note: print w/ replies, xml ) Need Help??


in reply to Autogenerate descending arrays

aah! I completely forgot about reverse!
Thank you fellow monks for your feedback, testing also shows that reverse is twice as fast as my method. I'm happy there's more than one way to do it ( or anything ).


Comment on Re: Autogenerate descending arrays
Replies are listed 'Best First'.
Re: Re: Autogenerate descending arrays
by kappa (Chaplain) on Mar 14, 2004 at 22:08 UTC
    By the way, using reverse is faster because this case is optimized as the action mentioned in the subject is very common :)
      How is it optimized?
        I stand corrected. Looks like foreach (reverse 1 .. 1000000) still generates a huge temporary list.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2015-07-30 15:24 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 (272 votes), past polls