[fpc-devel] about commit r29324

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Dec 28 14:26:05 CET 2014


Hi,

forwarded from Zeljko:

It's about fpc issue
http://bugs.freepascal.org/view.php?id=26370

It seems that TVariantArrayIterator.AtEnd loops for all Dims for no reason, so have 
impact on performance. 

*current implementation*
function TVariantArrayIterator.AtEnd: Boolean;
var
   i : sizeint;
begin
   result:=false;
   for i:=0 to Pred(Dims) do
     if Coords^[i] >= Bounds^[i].LowBound + Bounds^[i].ElementCount then
       result:=true;
end;

*optimized implementation*
function TVariantArrayIterator.AtEnd: Boolean;
var
   i : sizeint;
begin
   result:=false;
   for i:=0 to Pred(Dims) do
     if Coords^[i] >= Bounds^[i].LowBound + Bounds^[i].ElementCount then
     begin
       result:=true;
       break;
     end;
end;

Thanks.

Mattias



More information about the fpc-devel mailing list