Re: Fastcode CharPosIEx B&V 1.0.2



Hi

Now open the CPU view and observe that LStrLen is called once for every loop
iteration. The compiler should have been smart enough to observe that it is
loop invariant.

//while Index <= Length(S) do
mov eax,edi
call @LStrLen
cmp esi,eax
jle $0047a42c

We can code it like this

function CharPosIEx_NN_Pas_4_a(SearchChar : Char; const S: string; Offset:
Integer = 1) : Integer;
var
UpperSearchChar : Char;
Index, LengthS : Integer;

begin
Result := 0;
UpperSearchChar := UpCase_NN_Pas_1(SearchChar);
LengthS := Length(S);
Index := Offset;
if Index > 0 then
begin
while Index <= LengthS do
begin
if UpCase_NN_Pas_1(S[Index]) = UpperSearchChar then
begin
//We have a match
Result := Index;
Break;
end;
Inc(Index);
end;
end;
end;

Best regards
Dennis Kjaer Christensen

----------------------------------------------------------------------------
----
Jeg beskyttes af den gratis SPAMfighter til privatbrugere.
Den har indtil videre sparet mig for at få 5359 spam-mails
Betalende brugere får ikke denne besked i deres e-mails.
Hent en gratis SPAMfighter her.


.



Relevant Pages

  • Re: btrieve: 8.x and 9.x: get next returns not allways the next record
    ... Now running a loop like: ... We observe 3 different cases: ... ABCDEFGHIJKLMNOPQ ... nextrec again returns the first record: in this case we get: ...
    (comp.databases.btrieve)
  • Re: Demodulating QPSK
    ... I have a general-purpose PLL implemented as a primitive in a language where I can easily run signals through it, plot the outputs, and tweak its parameters: initial frequency, loop gain, loop bandwidth and I/Q filter bandwidth. ... When I process File1 through the PLL and observe the control frequency being fed back to the VFO (this would be the locked frequency), I see a brief transient while the loop acquires lock. ...
    (comp.dsp)
  • Re: Discovery: dictionaries load slow unless you have the right key/value pair in the right format
    ... then later, inside of a massive (million iteration) loop, I had this: ... Rectangle type) and the key, ... Anybody observe this? ... is being created everytime in the loop, ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Performance Issue with ForEach loop
    ... list-type structures followed the watered-down LIST scheme without current ... Structures upper division or graduate courses, ... more slow down one can observe. ... I have observed that if I do a loop over a collection ...
    (microsoft.public.dotnet.framework.performance)
  • Re: Efficiency of map and vector iterators
    ... I do six fast Fourier transforms (lengths ... > up to 100s) and several matrix-vector multiplies within each loop. ...
    (comp.lang.cpp)