http://qs321.pair.com?node_id=336544


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 ).

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.