Re: I need the fastest routine



Q Correll wrote:

Rudy,

I'm not sure if this is faster (I could imagine the optimizer
already does this), but it could be:

Your thought being that Value would be in the local stack?

Yes.

Note that aMin and aMax are out variables, i.e. accessed indirectly.
Hubert's idea of using local variables throughout (i.e. two local
variables for min and max) is probably even faster. I just checked it
(added a fifth variety to my test program), and indeed, it is 33%
faster than using aMax and aMin.

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

"If Tyranny and Oppression come to this land, it will be in
the guise of fighting a foreign enemy."
-- James Madison
.



Relevant Pages

  • Re: I need the fastest routine
    ... Rudy Velthuis [TeamB] wrote: ... Your thought being that Value would be in the local stack? ... Note that aMin and aMax are out variables, ...
    (borland.public.delphi.language.basm)
  • Re: I need the fastest routine
    ... procedure MinMaxArray(const aArray: Array of Integer; out aMax, ... aMin: integer); ... var p: pinteger; ...
    (borland.public.delphi.language.basm)
  • Re: Anyone recognise this sort algorithm?
    ... if A> AMax then AMax = A ... if A< Amin then Amin = A ... Counting sort runs in O, if the range is a known constant. ... Well spotted Arthur, I was convinced this type of sort had been ...
    (comp.programming)
  • Re: Anyone recognise this sort algorithm?
    ... I dont have the dos bat code to hand but here is what I mean by no ... if A> AMax then AMax = A ... if A< Amin then Amin = A ... @echo off ...
    (comp.programming)
  • Re: I need the fastest routine
    ... Rudy Velthuis [TeamB] wrote: ... if aArray> aMax then ... if aArray< aMin then ... FOUR pebbles. ...
    (borland.public.delphi.language.basm)