We don't bite newbies here... much | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I too, have issues with your benchmarks. In the top you are creating a temporary array, and using shift/pop, which just isn't needed. @_, $a[0], $a-1 would suffice and be faster. Assignmax2..4 aren't recursive so they don't even remotely do the same thing Assignmax, or Assignmax5 oddly you don't push/pop/shift/unshift on the, nor do you create a temporary array. This is also probably a poor area to optimize, assuming your not mutating the entire list.
I would imagine that List::Util would be atleast as fast as the fastest all perl solution. Logic would dictate that there is chance List::Util is optimized C (without looking at it) and in the event it isn't than someone has already done all the work your doing and figured out the fastest way to get a max(). Evan Carroll www.EvanCarroll.com In reply to Re: assigning the maximum of two numbers
by EvanCarroll
|
|