in reply to Re: Speed/Efficiency tweaks for a fannkuch benchmark script?
in thread Speed/Efficiency tweaks for a fannkuch benchmark script?
Hmm, the only problem with this is that my optimised routine gives the wrong answer. The bug is that, if the largest element is at the beginning or the smallest is at the end of the list, my test will skip it when it shouldn't. So the condition really needs to be something like:
Now it's a little faster than the original on my laptop, and a little slower on the Linux box.my ($n, $first, $last) = ($#$copy, @$copy[0,-1]); if ( ( $first == $n+1 || $first != max(@$copy[0..($first - + 1)]) ) && ( $last == 1 || $last != min(@$copy[($last - 1)..$n]) + )) { ...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Speed/Efficiency tweaks for a fannkuch benchmark script?
by thundergnat (Deacon) on Dec 01, 2005 at 19:20 UTC | |
by robin (Chaplain) on Dec 01, 2005 at 19:30 UTC | |
by thundergnat (Deacon) on Dec 01, 2005 at 19:39 UTC |
In Section
Seekers of Perl Wisdom