Ignore:
Timestamp:
Feb 7, 2012, 2:03:20 PM (13 years ago)
Author:
chronos
Message:
Location:
Generics/NativeGenerics/Demo
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Generics/NativeGenerics/Demo

    • Property svn:ignore
      •  

        old new  
        11lib
         2backup
         3Demo.exe
         4heaptrclog.trc
  • Generics/NativeGenerics/Demo/UMainForm.pas

    r313 r320  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   ComCtrls, GenericList, GenericDictionary, GenericQueue, GenericMatrix,
     9  ComCtrls, GenericList, GenericDictionary, GenericQueue,
    1010  DateUtils, SpecializedList;
    1111
     
    101101
    102102procedure TMainForm.ButtonMatrixIntegerClick(Sender: TObject);
    103 var
    104   Matrix: TGMatrix<Integer, Integer, Integer>;
    105   I: Integer;
    106 begin
    107   ListViewOutput.Clear;
     103//var
     104//  Matrix: TGMatrix<Integer, Integer, Integer>;
     105begin
     106  (*  ListViewOutput.Clear;
    108107  LabelTestName.Caption := 'TMatrixInteger test';
    109108  Matrix := TGMatrix<Integer, Integer, Integer>.Create;
     
    121120  finally
    122121    Free;
    123   end;
     122  end; *)
    124123end;
    125124
     
    130129
    131130procedure TMainForm.ButtonListObjectClick(Sender: TObject);
    132 var
    133   List: TGListObject<TObject>;
    134   I: Integer;
     131//var
     132  //List: TListObject<TObject>;
     133  //I: Integer;
    135134begin
    136135  (*ListViewOutput.Clear;
     
    182181
    183182procedure TMainForm.ButtonDictionaryStringClick(Sender: TObject);
    184 type
    185   TPairStringString = TGPair<String, String>;
    186 var
    187   Dictionary: TGDictionary<TPairStringString>;
     183//type
     184//  TPairStringString = TGPair<string, string>;
     185var
     186  Dictionary: TGDictionary<string, string>;
    188187begin
    189188  ListViewOutput.Clear;
    190189  LabelTestName.Caption := 'TDictionaryString test';
    191   Dictionary := TGDictionary<TPairStringString>.Create;
     190  Dictionary := TGDictionary<string, string>.Create;
    192191  with Dictionary do try
    193192    Add('Key1', 'Value1');
    194193    Add('Key2', 'Value2');
    195194    Add('Key3', 'Value3');
    196     WriteOutput('Add(''Key1'', ''Value1''),Add(''Key1'', ''Value1''),Add(''Key1'', ''Value1'')', Implode(',', StringPairToStr));
     195    WriteOutput('Add(''Key1'', ''Value1''),Add(''Key1'', ''Value1''),Add(''Key1'', ''Value1'')', List.Implode(',', StringPairToStr));
    197196    WriteOutput('Values[Key2]', Values['Key2']);
    198197    WriteOutput('Values[Key2] = None');
     
    392391
    393392procedure TMainForm.ButtonBenchmarkDictionaryClick(Sender: TObject);
    394 type
    395   TPairStringString = TGPair<String, String>;
    396 var
    397   Dictionary: TGDictionary<TPairStringString>;
     393//type
     394//  TPairStringString = TGPair<String, String>;
     395var
     396  Dictionary: TGDictionary<string, string>;
    398397  Dictionary2: TStringList;
    399398  StartTime: TDateTime;
     
    405404  try
    406405    UpdateButtonState(False);
    407     Dictionary := TGDictionary<TPairStringString>.Create;
     406    Dictionary := TGDictionary<string, string>.Create;
    408407    Dictionary2 := TStringList.Create;
    409408    Dictionary2.NameValueSeparator := '|';
     
    415414      I := I + 1;
    416415    until (Now - StartTime) > MeasureDuration;
    417     WriteOutput('TDictionaryStringString.Add', IntToStr(Dictionary.Count) + ' ops');
     416    WriteOutput('TDictionaryStringString.Add', IntToStr(Dictionary.List.Count) + ' ops');
    418417    Application.ProcessMessages;
    419418
     
    430429    StartTime := Now;
    431430    repeat
    432       R := Dictionary.Values[IntToStr(I mod Dictionary.Count)];
     431      R := Dictionary.Values[IntToStr(I mod Dictionary.List.Count)];
    433432      I := I + 1;
    434433    until (Now - StartTime) > MeasureDuration;
     
    448447    StartTime := Now;
    449448    repeat
    450       R := Dictionary.Keys[I mod Dictionary.Count];
     449      R := Dictionary.Keys[I mod Dictionary.List.Count];
    451450      I := I + 1;
    452451    until (Now - StartTime) > MeasureDuration;
     
    466465    StartTime := Now;
    467466    repeat
    468       R := Dictionary.Items[I mod Dictionary.Count].Value;
     467      R := Dictionary.List.Items[I mod Dictionary.List.Count].Value;
    469468      I := I + 1;
    470469    until (Now - StartTime) > MeasureDuration;
Note: See TracChangeset for help on using the changeset viewer.