Re: I need the fastest routine



Nenad Trkulja wrote:

<snip>

begin
if (aArray[n] < aMin) or (aArray[n+1] < aMin) or
(aArray[n+2] < aMin) or (aArray[n+3] < aMin) then
begin
if aArray[n] < aMin then
aMin := aArray[n];
if aArray[n+1] < aMin then
aMin := aArray[n+1];
if aArray[n+2] < aMin then
aMin := aArray[n+2];
if aArray[n+3] < aMin then
aMin := aArray[n+3];
end;

<snip>

That looks real cool, but is actually slightly slower than the code
Stig or I posted. I don't quite understand why you think that dividing
the array in 4 will make the code faster. The loop will be shorter, but
checking the loop variable is negligible compared to the comparisons
done in the loop.

I'll post my test to .attachments.

--
Rudy Velthuis [TeamB] http://www.teamb.com

"Basically, I no longer work for anything but the sensation I
have while working."
-- Albert Giacometti (sculptor)
.



Relevant Pages

  • Re: Various DOM-related wrappers (Code Worth Recommending Project)
    ... var start = ).getTime; ... sugar on top of what the browser offers. ... this was in a loop and I thought the join would be faster. ...
    (comp.lang.javascript)
  • Re: newbie: need inspiration
    ... Value holding input isn't really ... Loop should end when user ... That would be overloading the variable (it now has 2 purposes - ...
    (comp.unix.shell)
  • Re: foreach vs for
    ... > c-style loop and the foreach loop was an iterator. ... Note, this is not real Huffman encoding, just Larry Wall's version of it. ...
    (perl.beginners)
  • Re: Behavior when a do-iterator is changed
    ... "The INTENT attribute for a nonpointer dummy argument ... Since a DO loop variable is not definable, ... with a nonconforming code, including start WW III." ... (snip is identical to 1first attempt because the module is never ...
    (comp.lang.fortran)
  • Re: Endless loop question
    ... > actually turn this while loop into an endless loop instead of waiting ... This reads a character but doesn't do anything with it, ... into a buffer with fgets, and then pick the desired data value ...
    (comp.lang.c)