[fpc-pascal] Food for thought - language string improvement

Michael Van Canneyt michael at freepascal.org
Mon Jul 10 15:12:21 CEST 2017



On Mon, 10 Jul 2017, Sven Barth via fpc-pascal wrote:

> Am 10.07.2017 13:19 schrieb "Michael Van Canneyt" <michael at freepascal.org>:
>>
>>
>>
>> On Mon, 10 Jul 2017, Felipe Monteiro de Carvalho wrote:
>>
>>> On Mon, Jul 10, 2017 at 1:08 PM, Michael Van Canneyt
>>> <michael at freepascal.org> wrote:
>>>>
>>>> The code is definitely not the same. In each case, it was measured.
> There is
>>>> a 10% performance loss.
>>>
>>>
>>> I'd love a source on this one. I guess you mean in Free Pascal?
>>
>>
>> Obviously.
>>
>> The classes unit can be recompiled to use the fgl (well, that used to be
> so)
>> as a basis. When using the resulting list and stringlist, there was a 10%
>> performance loss. The main reason - If I recall correctly - was that the
> fgl needs to resort to move() operations instead of direct assignments.
>
> The fgl classes don't use Move(), but they have a virtual method that does
> the assignment between the specialized parameters that's inherited from the
> non-generic parent list type.

home:~/fpc/rtl/objpas> grep -i move fgl.pp

   System.Move(Src^, Dest^, FItemSize);
   System.Move(InternalItems[Index+1]^, ListItem^, (FCount - Index) * FItemSize);
     System.Move(ListItemPtr^, ResultPtr^, FItemSize);
   System.Move(InternalItems[Index1]^, InternalItems[FCapacity]^, FItemSize);
   System.Move(InternalItems[Index2]^, InternalItems[Index1]^, FItemSize);
   System.Move(InternalItems[FCapacity]^, InternalItems[Index2]^, FItemSize);
     System.Move(Result^, (Result+FItemSize)^, (FCount - Index) * FItemSize);
   System.Move(CurItem^, TmpItem^, FItemSize);
   System.Move(Src^, Dest^, MoveCount * FItemSize);
   System.Move(TmpItem^, NewItem^, FItemSize);
   System.Move(psrc^, pdest^, LItemSize);
   System.Move(Src^, Dest^, FKeySize);
   System.Move(Src^, Dest^, FDataSize);




More information about the fpc-pascal mailing list