Changeset 320 for Generics/NativeGenerics/Demo/UMainForm.pas
- Timestamp:
- Feb 7, 2012, 2:03:20 PM (13 years ago)
- Location:
- Generics/NativeGenerics/Demo
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Generics/NativeGenerics/Demo
- Property svn:ignore
-
old new 1 1 lib 2 backup 3 Demo.exe 4 heaptrclog.trc
-
- Property svn:ignore
-
Generics/NativeGenerics/Demo/UMainForm.pas
r313 r320 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 ComCtrls, GenericList, GenericDictionary, GenericQueue, GenericMatrix,9 ComCtrls, GenericList, GenericDictionary, GenericQueue, 10 10 DateUtils, SpecializedList; 11 11 … … 101 101 102 102 procedure 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>; 105 begin 106 (* ListViewOutput.Clear; 108 107 LabelTestName.Caption := 'TMatrixInteger test'; 109 108 Matrix := TGMatrix<Integer, Integer, Integer>.Create; … … 121 120 finally 122 121 Free; 123 end; 122 end; *) 124 123 end; 125 124 … … 130 129 131 130 procedure TMainForm.ButtonListObjectClick(Sender: TObject); 132 var133 List: TGListObject<TObject>;134 I: Integer;131 //var 132 //List: TListObject<TObject>; 133 //I: Integer; 135 134 begin 136 135 (*ListViewOutput.Clear; … … 182 181 183 182 procedure TMainForm.ButtonDictionaryStringClick(Sender: TObject); 184 type185 TPairStringString = TGPair<String, String>;186 var 187 Dictionary: TGDictionary< TPairStringString>;183 //type 184 // TPairStringString = TGPair<string, string>; 185 var 186 Dictionary: TGDictionary<string, string>; 188 187 begin 189 188 ListViewOutput.Clear; 190 189 LabelTestName.Caption := 'TDictionaryString test'; 191 Dictionary := TGDictionary< TPairStringString>.Create;190 Dictionary := TGDictionary<string, string>.Create; 192 191 with Dictionary do try 193 192 Add('Key1', 'Value1'); 194 193 Add('Key2', 'Value2'); 195 194 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)); 197 196 WriteOutput('Values[Key2]', Values['Key2']); 198 197 WriteOutput('Values[Key2] = None'); … … 392 391 393 392 procedure TMainForm.ButtonBenchmarkDictionaryClick(Sender: TObject); 394 type395 TPairStringString = TGPair<String, String>;396 var 397 Dictionary: TGDictionary< TPairStringString>;393 //type 394 // TPairStringString = TGPair<String, String>; 395 var 396 Dictionary: TGDictionary<string, string>; 398 397 Dictionary2: TStringList; 399 398 StartTime: TDateTime; … … 405 404 try 406 405 UpdateButtonState(False); 407 Dictionary := TGDictionary< TPairStringString>.Create;406 Dictionary := TGDictionary<string, string>.Create; 408 407 Dictionary2 := TStringList.Create; 409 408 Dictionary2.NameValueSeparator := '|'; … … 415 414 I := I + 1; 416 415 until (Now - StartTime) > MeasureDuration; 417 WriteOutput('TDictionaryStringString.Add', IntToStr(Dictionary. Count) + ' ops');416 WriteOutput('TDictionaryStringString.Add', IntToStr(Dictionary.List.Count) + ' ops'); 418 417 Application.ProcessMessages; 419 418 … … 430 429 StartTime := Now; 431 430 repeat 432 R := Dictionary.Values[IntToStr(I mod Dictionary. Count)];431 R := Dictionary.Values[IntToStr(I mod Dictionary.List.Count)]; 433 432 I := I + 1; 434 433 until (Now - StartTime) > MeasureDuration; … … 448 447 StartTime := Now; 449 448 repeat 450 R := Dictionary.Keys[I mod Dictionary. Count];449 R := Dictionary.Keys[I mod Dictionary.List.Count]; 451 450 I := I + 1; 452 451 until (Now - StartTime) > MeasureDuration; … … 466 465 StartTime := Now; 467 466 repeat 468 R := Dictionary. Items[I mod Dictionary.Count].Value;467 R := Dictionary.List.Items[I mod Dictionary.List.Count].Value; 469 468 I := I + 1; 470 469 until (Now - StartTime) > MeasureDuration;
Note:
See TracChangeset
for help on using the changeset viewer.