Changeset 219 for Generics


Ignore:
Timestamp:
Mar 24, 2011, 6:50:50 AM (14 years ago)
Author:
george
Message:
  • Modified: Optimized TGList.IndexOf.
  • Used better compiler optimization level 3 for library.
Location:
Generics/TemplateGenerics
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • Generics/TemplateGenerics/Demo/Demo.lpi

    r112 r219  
    3838      </Item2>
    3939    </RequiredPackages>
    40     <Units Count="62">
     40    <Units Count="66">
    4141      <Unit0>
    4242        <Filename Value="Demo.lpr"/>
     
    5555        <ResourceBaseClass Value="Form"/>
    5656        <UnitName Value="UMainForm"/>
     57        <IsVisibleTab Value="True"/>
    5758        <EditorIndex Value="0"/>
    5859        <WindowIndex Value="0"/>
    59         <TopLine Value="232"/>
    60         <CursorPos X="19" Y="237"/>
     60        <TopLine Value="645"/>
     61        <CursorPos X="28" Y="663"/>
    6162        <UsageCount Value="233"/>
    6263        <Bookmarks Count="1">
     
    7879        <Filename Value="../Specialized/SpecializedList.pas"/>
    7980        <UnitName Value="SpecializedList"/>
    80         <EditorIndex Value="2"/>
    81         <WindowIndex Value="0"/>
    82         <TopLine Value="3"/>
    83         <CursorPos X="43" Y="13"/>
     81        <EditorIndex Value="1"/>
     82        <WindowIndex Value="0"/>
     83        <TopLine Value="47"/>
     84        <CursorPos X="20" Y="60"/>
    8485        <UsageCount Value="10"/>
    8586        <Loaded Value="True"/>
     
    312313      <Unit32>
    313314        <Filename Value="../Generic/GenericList.inc"/>
    314         <IsVisibleTab Value="True"/>
    315         <EditorIndex Value="6"/>
    316         <WindowIndex Value="0"/>
    317         <TopLine Value="462"/>
    318         <CursorPos X="40" Y="470"/>
     315        <EditorIndex Value="2"/>
     316        <WindowIndex Value="0"/>
     317        <TopLine Value="227"/>
     318        <CursorPos X="29" Y="238"/>
    319319        <UsageCount Value="107"/>
    320320        <Loaded Value="True"/>
     
    433433        <CursorPos X="37" Y="2636"/>
    434434        <UsageCount Value="90"/>
     435        <DefaultSyntaxHighlighter Value="Delphi"/>
    435436      </Unit47>
    436437      <Unit48>
     
    448449        <CursorPos X="14" Y="213"/>
    449450        <UsageCount Value="28"/>
     451        <DefaultSyntaxHighlighter Value="Delphi"/>
    450452      </Unit49>
    451453      <Unit50>
     
    455457        <CursorPos X="3" Y="201"/>
    456458        <UsageCount Value="28"/>
     459        <DefaultSyntaxHighlighter Value="Delphi"/>
    457460      </Unit50>
    458461      <Unit51>
     
    470473        <CursorPos X="27" Y="26"/>
    471474        <UsageCount Value="28"/>
     475        <DefaultSyntaxHighlighter Value="Delphi"/>
    472476      </Unit52>
    473477      <Unit53>
     
    477481        <CursorPos X="3" Y="398"/>
    478482        <UsageCount Value="28"/>
     483        <DefaultSyntaxHighlighter Value="Delphi"/>
    479484      </Unit53>
    480485      <Unit54>
     
    484489        <CursorPos X="10" Y="503"/>
    485490        <UsageCount Value="7"/>
     491        <DefaultSyntaxHighlighter Value="Delphi"/>
    486492      </Unit54>
    487493      <Unit55>
     
    491497        <CursorPos X="22" Y="2273"/>
    492498        <UsageCount Value="19"/>
     499        <DefaultSyntaxHighlighter Value="Delphi"/>
    493500      </Unit55>
    494501      <Unit56>
     
    512519      <Unit58>
    513520        <Filename Value="../../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/dateutil.inc"/>
    514         <EditorIndex Value="5"/>
    515521        <WindowIndex Value="0"/>
    516522        <TopLine Value="38"/>
    517523        <CursorPos X="3" Y="50"/>
    518524        <UsageCount Value="11"/>
    519         <Loaded Value="True"/>
     525        <DefaultSyntaxHighlighter Value="Delphi"/>
    520526      </Unit58>
    521527      <Unit59>
    522528        <Filename Value="../../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/classes/classesh.inc"/>
    523         <EditorIndex Value="1"/>
    524529        <WindowIndex Value="0"/>
    525530        <TopLine Value="649"/>
    526531        <CursorPos X="38" Y="671"/>
    527532        <UsageCount Value="10"/>
    528         <Loaded Value="True"/>
     533        <DefaultSyntaxHighlighter Value="Delphi"/>
    529534      </Unit59>
    530535      <Unit60>
    531536        <Filename Value="../../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/classes/stringl.inc"/>
    532         <EditorIndex Value="4"/>
    533537        <WindowIndex Value="0"/>
    534538        <TopLine Value="1185"/>
    535539        <CursorPos X="22" Y="1196"/>
    536540        <UsageCount Value="10"/>
    537         <Loaded Value="True"/>
     541        <DefaultSyntaxHighlighter Value="Delphi"/>
    538542      </Unit60>
    539543      <Unit61>
    540544        <Filename Value="../../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/types.pp"/>
    541545        <UnitName Value="types"/>
    542         <EditorIndex Value="3"/>
    543546        <WindowIndex Value="0"/>
    544547        <TopLine Value="112"/>
    545548        <CursorPos X="3" Y="124"/>
    546549        <UsageCount Value="10"/>
    547         <Loaded Value="True"/>
     550        <DefaultSyntaxHighlighter Value="Delphi"/>
    548551      </Unit61>
     552      <Unit62>
     553        <Filename Value="../../../../../Projekty2/FreePascalManager/trunk/Instance/1/FPC/rtl/objpas/sysutils/sysstrh.inc"/>
     554        <EditorIndex Value="3"/>
     555        <WindowIndex Value="0"/>
     556        <TopLine Value="71"/>
     557        <CursorPos X="10" Y="84"/>
     558        <UsageCount Value="10"/>
     559        <Loaded Value="True"/>
     560      </Unit62>
     561      <Unit63>
     562        <Filename Value="../../../../../Projekty2/FreePascalManager/trunk/Instance/1/FPC/rtl/objpas/sysutils/sysstr.inc"/>
     563        <EditorIndex Value="4"/>
     564        <WindowIndex Value="0"/>
     565        <TopLine Value="148"/>
     566        <CursorPos X="11" Y="169"/>
     567        <UsageCount Value="10"/>
     568        <Loaded Value="True"/>
     569      </Unit63>
     570      <Unit64>
     571        <Filename Value="../../../../../Projekty2/FreePascalManager/trunk/Instance/1/FPC/rtl/inc/systemh.inc"/>
     572        <EditorIndex Value="5"/>
     573        <WindowIndex Value="0"/>
     574        <TopLine Value="511"/>
     575        <CursorPos X="11" Y="524"/>
     576        <UsageCount Value="10"/>
     577        <Loaded Value="True"/>
     578      </Unit64>
     579      <Unit65>
     580        <Filename Value="../../../../../Projekty2/FreePascalManager/trunk/Instance/1/FPC/rtl/i386/i386.inc"/>
     581        <EditorIndex Value="6"/>
     582        <WindowIndex Value="0"/>
     583        <TopLine Value="411"/>
     584        <CursorPos X="10" Y="424"/>
     585        <UsageCount Value="10"/>
     586        <Loaded Value="True"/>
     587      </Unit65>
    549588    </Units>
    550589    <JumpHistory Count="30" HistoryIndex="27">
    551590      <Position1>
    552591        <Filename Value="UMainForm.pas"/>
    553         <Caret Line="42" Column="51" TopLine="20"/>
     592        <Caret Line="617" Column="1" TopLine="593"/>
    554593      </Position1>
    555594      <Position2>
    556595        <Filename Value="UMainForm.pas"/>
    557         <Caret Line="458" Column="36" TopLine="440"/>
     596        <Caret Line="260" Column="25" TopLine="230"/>
    558597      </Position2>
    559598      <Position3>
    560599        <Filename Value="UMainForm.pas"/>
    561         <Caret Line="7" Column="52" TopLine="1"/>
     600        <Caret Line="246" Column="21" TopLine="233"/>
    562601      </Position3>
    563602      <Position4>
    564603        <Filename Value="UMainForm.pas"/>
    565         <Caret Line="526" Column="1" TopLine="502"/>
     604        <Caret Line="364" Column="25" TopLine="358"/>
    566605      </Position4>
    567606      <Position5>
    568607        <Filename Value="UMainForm.pas"/>
    569         <Caret Line="32" Column="49" TopLine="27"/>
     608        <Caret Line="596" Column="33" TopLine="586"/>
    570609      </Position5>
    571610      <Position6>
    572611        <Filename Value="UMainForm.pas"/>
    573         <Caret Line="416" Column="38" TopLine="312"/>
     612        <Caret Line="237" Column="19" TopLine="232"/>
    574613      </Position6>
    575614      <Position7>
    576         <Filename Value="UMainForm.pas"/>
    577         <Caret Line="417" Column="38" TopLine="393"/>
     615        <Filename Value="../Generic/GenericList.inc"/>
     616        <Caret Line="468" Column="70" TopLine="462"/>
    578617      </Position7>
    579618      <Position8>
    580         <Filename Value="UMainForm.pas"/>
    581         <Caret Line="418" Column="38" TopLine="394"/>
     619        <Filename Value="../Generic/GenericList.inc"/>
     620        <Caret Line="469" Column="1" TopLine="462"/>
    582621      </Position8>
    583622      <Position9>
    584         <Filename Value="UMainForm.pas"/>
    585         <Caret Line="241" Column="3" TopLine="234"/>
     623        <Filename Value="../Generic/GenericList.inc"/>
     624        <Caret Line="470" Column="1" TopLine="462"/>
    586625      </Position9>
    587626      <Position10>
    588         <Filename Value="UMainForm.pas"/>
    589         <Caret Line="377" Column="1" TopLine="361"/>
     627        <Filename Value="../Generic/GenericList.inc"/>
     628        <Caret Line="471" Column="1" TopLine="462"/>
    590629      </Position10>
    591630      <Position11>
    592         <Filename Value="UMainForm.pas"/>
    593         <Caret Line="617" Column="1" TopLine="593"/>
     631        <Filename Value="../Generic/GenericList.inc"/>
     632        <Caret Line="470" Column="5" TopLine="462"/>
    594633      </Position11>
    595634      <Position12>
    596635        <Filename Value="UMainForm.pas"/>
    597         <Caret Line="260" Column="25" TopLine="230"/>
     636        <Caret Line="237" Column="19" TopLine="232"/>
    598637      </Position12>
    599638      <Position13>
    600639        <Filename Value="UMainForm.pas"/>
    601         <Caret Line="246" Column="21" TopLine="233"/>
     640        <Caret Line="237" Column="19" TopLine="232"/>
    602641      </Position13>
    603642      <Position14>
    604643        <Filename Value="UMainForm.pas"/>
    605         <Caret Line="364" Column="25" TopLine="358"/>
     644        <Caret Line="495" Column="26" TopLine="482"/>
    606645      </Position14>
    607646      <Position15>
    608647        <Filename Value="UMainForm.pas"/>
    609         <Caret Line="596" Column="33" TopLine="586"/>
     648        <Caret Line="503" Column="9" TopLine="490"/>
    610649      </Position15>
    611650      <Position16>
    612651        <Filename Value="UMainForm.pas"/>
    613         <Caret Line="237" Column="19" TopLine="232"/>
     652        <Caret Line="480" Column="3" TopLine="467"/>
    614653      </Position16>
    615654      <Position17>
    616         <Filename Value="../../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/classes/classesh.inc"/>
    617         <Caret Line="701" Column="36" TopLine="683"/>
     655        <Filename Value="UMainForm.pas"/>
     656        <Caret Line="511" Column="32" TopLine="498"/>
    618657      </Position17>
    619658      <Position18>
    620         <Filename Value="../../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/classes/classesh.inc"/>
    621         <Caret Line="659" Column="27" TopLine="653"/>
     659        <Filename Value="UMainForm.pas"/>
     660        <Caret Line="519" Column="33" TopLine="506"/>
    622661      </Position18>
    623662      <Position19>
    624         <Filename Value="../Generic/GenericList.inc"/>
    625         <Caret Line="468" Column="70" TopLine="462"/>
     663        <Filename Value="UMainForm.pas"/>
     664        <Caret Line="526" Column="26" TopLine="513"/>
    626665      </Position19>
    627666      <Position20>
    628         <Filename Value="../Generic/GenericList.inc"/>
    629         <Caret Line="469" Column="1" TopLine="462"/>
     667        <Filename Value="UMainForm.pas"/>
     668        <Caret Line="538" Column="27" TopLine="525"/>
    630669      </Position20>
    631670      <Position21>
    632         <Filename Value="../Generic/GenericList.inc"/>
    633         <Caret Line="470" Column="1" TopLine="462"/>
     671        <Filename Value="UMainForm.pas"/>
     672        <Caret Line="549" Column="26" TopLine="536"/>
    634673      </Position21>
    635674      <Position22>
    636         <Filename Value="../Generic/GenericList.inc"/>
    637         <Caret Line="471" Column="1" TopLine="462"/>
     675        <Filename Value="UMainForm.pas"/>
     676        <Caret Line="561" Column="25" TopLine="548"/>
    638677      </Position22>
    639678      <Position23>
    640         <Filename Value="../Generic/GenericList.inc"/>
    641         <Caret Line="470" Column="5" TopLine="462"/>
     679        <Filename Value="UMainForm.pas"/>
     680        <Caret Line="572" Column="16" TopLine="559"/>
    642681      </Position23>
    643682      <Position24>
    644683        <Filename Value="UMainForm.pas"/>
    645         <Caret Line="237" Column="19" TopLine="232"/>
     684        <Caret Line="584" Column="25" TopLine="571"/>
    646685      </Position24>
    647686      <Position25>
    648         <Filename Value="../../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/classes/classesh.inc"/>
    649         <Caret Line="659" Column="26" TopLine="647"/>
     687        <Filename Value="UMainForm.pas"/>
     688        <Caret Line="595" Column="26" TopLine="582"/>
    650689      </Position25>
    651690      <Position26>
    652         <Filename Value="../../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/classes/stringl.inc"/>
    653         <Caret Line="1193" Column="20" TopLine="1185"/>
     691        <Filename Value="../Generic/GenericList.inc"/>
     692        <Caret Line="214" Column="12" TopLine="201"/>
    654693      </Position26>
    655694      <Position27>
    656         <Filename Value="../../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/classes/stringl.inc"/>
    657         <Caret Line="1196" Column="22" TopLine="1185"/>
     695        <Filename Value="../Generic/GenericList.inc"/>
     696        <Caret Line="231" Column="16" TopLine="218"/>
    658697      </Position27>
    659698      <Position28>
    660         <Filename Value="../../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/classes/classesh.inc"/>
    661         <Caret Line="661" Column="23" TopLine="649"/>
     699        <Filename Value="UMainForm.pas"/>
     700        <Caret Line="634" Column="11" TopLine="614"/>
    662701      </Position28>
    663702      <Position29>
    664         <Filename Value="../../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/classes/classesh.inc"/>
    665         <Caret Line="657" Column="48" TopLine="644"/>
     703        <Filename Value="UMainForm.pas"/>
     704        <Caret Line="479" Column="12" TopLine="467"/>
    666705      </Position29>
    667706      <Position30>
    668         <Filename Value="../../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/classes/classesh.inc"/>
    669         <Caret Line="651" Column="3" TopLine="639"/>
     707        <Filename Value="../Generic/GenericList.inc"/>
     708        <Caret Line="23" Column="58" TopLine="9"/>
    670709      </Position30>
    671710    </JumpHistory>
    672711  </ProjectOptions>
    673712  <CompilerOptions>
    674     <Version Value="9"/>
     713    <Version Value="10"/>
    675714    <Target>
    676715      <Filename Value="Demo"/>
  • Generics/TemplateGenerics/Demo/UMainForm.pas

    r111 r219  
    478478var
    479479  List: TListPointer;
    480   List2: TList;
     480  List2: TFPList;
    481481  StartTime: TDateTime;
    482482  I: Integer;
     
    484484  SampleCount: Integer = 100000;
    485485begin
    486   LabelTestName.Caption := 'Generic specialized TListObject vs. classic non-generic TList benchmark';
     486  LabelTestName.Caption := 'Generic specialized TListObject vs. classic non-generic TFPList benchmark';
    487487  ListViewOutput.Clear;
    488488  try
    489489    UpdateButtonState(False);
    490490    List := TListPointer.Create;
    491     List2 := TList.Create;
    492 
    493     StartTime := Now;
    494     repeat
    495       List.Add(1);
     491    List2 := TFPList.Create;
     492
     493    WriteOutput('TListPointer.InstanceSize', IntToStr(TListPointer.InstanceSize) + ' bytes');
     494    WriteOutput('TFPList.InstanceSize', IntToStr(TFPList.InstanceSize) + ' bytes');
     495
     496    StartTime := Now;
     497    repeat
     498      List.Add(Pointer(1));
    496499    until (Now - StartTime) > MeasureDuration;
    497500    WriteOutput('TListPointer.Add', IntToStr(List.Count) + ' ops');
     
    501504    StartTime := Now;
    502505    repeat
    503       List2.Add(1);
    504     until (Now - StartTime) > MeasureDuration;
    505     WriteOutput('TList.Add', IntToStr(List2.Count) + ' ops');
     506      List2.Add(Pointer(1));
     507    until (Now - StartTime) > MeasureDuration;
     508    WriteOutput('TFPList.Add', IntToStr(List2.Count) + ' ops');
    506509    List2.Clear;
    507510    Application.ProcessMessages;
     
    509512    StartTime := Now;
    510513    repeat
    511       List.Insert(0, 1);
     514      List.Insert(0, Pointer(1));
    512515    until (Now - StartTime) > MeasureDuration;
    513516    WriteOutput('TListPointer.Insert', IntToStr(List.Count) + ' ops');
     
    517520    StartTime := Now;
    518521    repeat
    519       List2.Insert(0, 1);
    520     until (Now - StartTime) > MeasureDuration;
    521     WriteOutput('TList.Insert', IntToStr(List2.Count) + ' ops');
     522      List2.Insert(0, Pointer(1));
     523    until (Now - StartTime) > MeasureDuration;
     524    WriteOutput('TFPList.Insert', IntToStr(List2.Count) + ' ops');
    522525    List2.Clear;
    523526    Application.ProcessMessages;
    524527
    525528    for I := 0 to SampleCount - 1 do
    526       List.Add(1);
     529      List.Add(Pointer(1));
    527530    StartTime := Now;
    528531    I := 0;
     
    536539
    537540    for I := 0 to SampleCount - 1 do
    538       List2.Add(1);
     541      List2.Add(Pointer(1));
    539542    StartTime := Now;
    540543    I := 0;
     
    543546      Inc(I);
    544547    until (Now - StartTime) > MeasureDuration;
    545     WriteOutput('TList.Delete', IntToStr(I) + ' ops');
    546     Application.ProcessMessages;
    547 
    548     for I := 0 to SampleCount - 1 do
    549       List.Add(1);
     548    WriteOutput('TFPList.Delete', IntToStr(I) + ' ops');
     549    Application.ProcessMessages;
     550
     551    for I := 0 to SampleCount - 1 do
     552      List.Add(Pointer(1));
    550553    StartTime := Now;
    551554    I := 0;
     
    559562
    560563    for I := 0 to SampleCount - 1 do
    561     List2.Add(1);
     564    List2.Add(Pointer(1));
    562565    StartTime := Now;
    563566    I := 0;
     
    566569      Inc(I);
    567570    until (Now - StartTime) > MeasureDuration;
    568     WriteOutput('TList.Move', IntToStr(I) + ' ops');
    569     Application.ProcessMessages;
    570 
    571     for I := 0 to SampleCount - 1 do
    572       List.Add(1);
     571    WriteOutput('TFPList.Move', IntToStr(I) + ' ops');
     572    Application.ProcessMessages;
     573
     574    for I := 0 to SampleCount - 1 do
     575      List.Add(Pointer(1));
    573576    StartTime := Now;
    574577    I := 0;
     
    582585
    583586    for I := 0 to SampleCount - 1 do
    584     List2.Add(1);
     587    List2.Add(Pointer(1));
    585588    StartTime := Now;
    586589    I := 0;
     
    589592      Inc(I);
    590593    until (Now - StartTime) > MeasureDuration;
    591     WriteOutput('TList.Exchange', IntToStr(I) + ' ops');
    592     Application.ProcessMessages;
    593 
    594     for I := 0 to SampleCount - 1 do
    595       List.Add(1);
     594    WriteOutput('TFPList.Exchange', IntToStr(I) + ' ops');
     595    Application.ProcessMessages;
     596
     597    for I := 0 to SampleCount - 1 do
     598      List.Add(Pointer(1));
    596599    StartTime := Now;
    597600    I := 0;
     
    605608
    606609    for I := 0 to SampleCount - 1 do
    607     List2.Add(1);
     610    List2.Add(Pointer(1));
    608611    StartTime := Now;
    609612    I := 0;
     
    612615      Inc(I);
    613616    until (Now - StartTime) > MeasureDuration;
    614     WriteOutput('TList.IndexOf', IntToStr(I) + ' ops');
    615     Application.ProcessMessages;
    616 
     617    WriteOutput('TFPList.IndexOf', IntToStr(I) + ' ops');
     618    Application.ProcessMessages;
     619
     620    for I := 0 to SampleCount - 1 do
     621      List.Add(Pointer(1));
     622    StartTime := Now;
     623    I := 0;
     624    repeat
     625      List[I mod List.Count] := Pointer(1);
     626      Inc(I);
     627    until (Now - StartTime) > MeasureDuration;
     628    WriteOutput('TListPointer[I] write', IntToStr(I) + ' ops');
     629    List.Clear;
     630    Application.ProcessMessages;
     631
     632    for I := 0 to SampleCount - 1 do
     633    List2.Add(Pointer(1));
     634    StartTime := Now;
     635    I := 0;
     636    repeat
     637      List2[I mod List2.Count] := Pointer(1);
     638      Inc(I);
     639    until (Now - StartTime) > MeasureDuration;
     640    WriteOutput('TFPList[I] write', IntToStr(I) + ' ops');
     641    Application.ProcessMessages;
     642
     643    for I := 0 to SampleCount - 1 do
     644      List.Add(Pointer(1));
     645    StartTime := Now;
     646    I := 0;
     647    repeat
     648      List[I mod List.Count];
     649      Inc(I);
     650    until (Now - StartTime) > MeasureDuration;
     651    WriteOutput('TListPointer[I] read', IntToStr(I) + ' ops');
     652    List.Clear;
     653    Application.ProcessMessages;
     654
     655    for I := 0 to SampleCount - 1 do
     656    List2.Add(Pointer(1));
     657    StartTime := Now;
     658    I := 0;
     659    repeat
     660      List2[I mod List2.Count];
     661      Inc(I);
     662    until (Now - StartTime) > MeasureDuration;
     663    WriteOutput('TFPList[I] read', IntToStr(I) + ' ops');
     664    Application.ProcessMessages;
    617665  finally
    618666    UpdateButtonState(True);
  • Generics/TemplateGenerics/Generic/GenericList.inc

    r175 r219  
    2525    procedure QuickSort(L, R : TGListIndex; Compare: TGListSortCompare);
    2626  public
     27    function CompareMem(P1, P2: Pointer; Length: cardinal): Boolean; inline;
    2728    function Add(Item: TGListItem): TGListIndex;
    2829    procedure AddArray(Values: array of TGListItem);
     
    208209end;
    209210
     211function TGList.CompareMem(P1, P2: Pointer; Length: cardinal): Boolean;
     212var
     213  I: Cardinal;
     214begin
     215  Result := True;
     216  I := 0;
     217  if (P1) <> (P2) then
     218    while Result and (I < Length) do
     219    begin
     220      Result := PByte(P1)^ = PByte(P2)^;
     221      Inc(I);
     222      Inc(pchar(P1));
     223      Inc(pchar(P2));
     224    end;
     225end;
     226
    210227function TGList.IndexOf(Item: TGListItem; Start: TGListIndex): TGListIndex;
    211228begin
    212229  Result := Start;
    213230  while (Result < FCount) and
    214   not CompareMem(Addr(FItems[Result]), Addr(Item), SizeOf(TGListItem)) do
     231  not CompareMem(@FItems[Result], @Item, SizeOf(TGListItem)) do
     232//  not (CompareByte(FItems[Result], Item, SizeOf(TGListItem)) = 0) do
    215233    Result := Result + 1;
    216234  if Result = FCount then Result := -1;
  • Generics/TemplateGenerics/TemplateGenerics.lpk

    r196 r219  
    1313        <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
    1414      </SearchPaths>
     15      <CodeGeneration>
     16        <Optimizations>
     17          <VariablesInRegisters Value="True"/>
     18          <OptimizationLevel Value="3"/>
     19        </Optimizations>
     20      </CodeGeneration>
    1521      <Other>
     22        <CompilerMessages>
     23          <UseMsgFile Value="True"/>
     24        </CompilerMessages>
    1625        <CompilerPath Value="$(CompPath)"/>
    1726      </Other>
     
    6675      <Item12>
    6776        <Filename Value="Generic\GenericBitmap.inc"/>
     77        <UnitName Value="GenericBitmap"/>
    6878      </Item12>
    6979      <Item13>
Note: See TracChangeset for help on using the changeset viewer.