- Timestamp:
- Oct 30, 2010, 7:31:20 PM (14 years ago)
- Location:
- Generics/TemplateGenerics
- Files:
-
- 1 added
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Generics/TemplateGenerics/Demo/Demo.lpi
r78 r80 38 38 </Item2> 39 39 </RequiredPackages> 40 <Units Count=" 69">40 <Units Count="70"> 41 41 <Unit0> 42 42 <Filename Value="Demo.lpr"/> 43 43 <IsPartOfProject Value="True"/> 44 44 <UnitName Value="Demo"/> 45 <EditorIndex Value="1 1"/>45 <EditorIndex Value="12"/> 46 46 <WindowIndex Value="0"/> 47 47 <TopLine Value="1"/> 48 48 <CursorPos X="26" Y="8"/> 49 <UsageCount Value="5 3"/>49 <UsageCount Value="54"/> 50 50 <Loaded Value="True"/> 51 51 <DefaultSyntaxHighlighter Value="Delphi"/> … … 60 60 <EditorIndex Value="0"/> 61 61 <WindowIndex Value="0"/> 62 <TopLine Value=" 302"/>63 <CursorPos X=" 47" Y="319"/>64 <UsageCount Value="5 3"/>62 <TopLine Value="411"/> 63 <CursorPos X="63" Y="428"/> 64 <UsageCount Value="54"/> 65 65 <Loaded Value="True"/> 66 66 <LoadedDesigner Value="True"/> … … 184 184 <EditorIndex Value="2"/> 185 185 <WindowIndex Value="0"/> 186 <TopLine Value=" 246"/>187 <CursorPos X=" 21" Y="273"/>186 <TopLine Value="558"/> 187 <CursorPos X="14" Y="575"/> 188 188 <UsageCount Value="12"/> 189 189 <Loaded Value="True"/> … … 192 192 <Unit17> 193 193 <Filename Value="/usr/share/fpcsrc/rtl/objpas/classes/lists.inc"/> 194 <EditorIndex Value=" 3"/>194 <EditorIndex Value="4"/> 195 195 <WindowIndex Value="0"/> 196 196 <TopLine Value="588"/> … … 211 211 <Filename Value="../Specialized/ListDouble.pas"/> 212 212 <UnitName Value="ListDouble"/> 213 <EditorIndex Value="1 2"/>213 <EditorIndex Value="13"/> 214 214 <WindowIndex Value="0"/> 215 215 <TopLine Value="1"/> … … 221 221 <Filename Value="../Specialized/ListInteger.pas"/> 222 222 <UnitName Value="ListInteger"/> 223 <EditorIndex Value="1 3"/>223 <EditorIndex Value="14"/> 224 224 <WindowIndex Value="0"/> 225 225 <TopLine Value="1"/> … … 231 231 <Filename Value="../Specialized/ListObject.pas"/> 232 232 <UnitName Value="ListObject"/> 233 <EditorIndex Value="1 5"/>233 <EditorIndex Value="16"/> 234 234 <WindowIndex Value="0"/> 235 235 <TopLine Value="33"/> … … 241 241 <Filename Value="../Specialized/ListPointer.pas"/> 242 242 <UnitName Value="ListPointer"/> 243 <EditorIndex Value="1 7"/>243 <EditorIndex Value="18"/> 244 244 <WindowIndex Value="0"/> 245 245 <TopLine Value="1"/> … … 251 251 <Filename Value="../Specialized/TreeString.pas"/> 252 252 <UnitName Value="TreeString"/> 253 <EditorIndex Value="1 8"/>253 <EditorIndex Value="19"/> 254 254 <WindowIndex Value="0"/> 255 255 <TopLine Value="1"/> … … 261 261 <Filename Value="../Specialized/TreePointer.pas"/> 262 262 <UnitName Value="TreePointer"/> 263 <EditorIndex Value=" 19"/>263 <EditorIndex Value="20"/> 264 264 <WindowIndex Value="0"/> 265 265 <TopLine Value="1"/> … … 271 271 <Filename Value="../Specialized/TreeObject.pas"/> 272 272 <UnitName Value="TreeObject"/> 273 <EditorIndex Value="2 0"/>273 <EditorIndex Value="21"/> 274 274 <WindowIndex Value="0"/> 275 275 <TopLine Value="1"/> … … 281 281 <Filename Value="../Specialized/TreeInteger.pas"/> 282 282 <UnitName Value="TreeInteger"/> 283 <EditorIndex Value="2 1"/>283 <EditorIndex Value="22"/> 284 284 <WindowIndex Value="0"/> 285 285 <TopLine Value="1"/> … … 300 300 <Unit28> 301 301 <Filename Value="../Generic/TreeImplementation.tpl"/> 302 <EditorIndex Value="2 2"/>302 <EditorIndex Value="23"/> 303 303 <WindowIndex Value="0"/> 304 304 <TopLine Value="1"/> … … 340 340 <Unit32> 341 341 <Filename Value="../Generic/DictionaryImplementation.tpl"/> 342 <EditorIndex Value="2 3"/>343 <WindowIndex Value="0"/> 344 <TopLine Value=" 23"/>345 <CursorPos X=" 1" Y="2"/>342 <EditorIndex Value="24"/> 343 <WindowIndex Value="0"/> 344 <TopLine Value="4"/> 345 <CursorPos X="3" Y="6"/> 346 346 <UsageCount Value="25"/> 347 347 <Loaded Value="True"/> … … 350 350 <Unit33> 351 351 <Filename Value="../Generic/DictionaryInterface.tpl"/> 352 <EditorIndex Value="2 7"/>353 <WindowIndex Value="0"/> 354 <TopLine Value="1"/> 355 <CursorPos X="1 " Y="9"/>352 <EditorIndex Value="28"/> 353 <WindowIndex Value="0"/> 354 <TopLine Value="1"/> 355 <CursorPos X="14" Y="16"/> 356 356 <UsageCount Value="25"/> 357 357 <Loaded Value="True"/> … … 361 361 <Filename Value="../Specialized/DictionaryString.pas"/> 362 362 <UnitName Value="DictionaryString"/> 363 <EditorIndex Value="28"/>364 363 <WindowIndex Value="0"/> 365 364 <TopLine Value="1"/> 366 365 <CursorPos X="32" Y="18"/> 367 366 <UsageCount Value="25"/> 368 <Loaded Value="True"/>369 367 </Unit34> 370 368 <Unit35> 371 369 <Filename Value="../Generic/StackInterface.tpl"/> 372 <EditorIndex Value="2 4"/>370 <EditorIndex Value="25"/> 373 371 <WindowIndex Value="0"/> 374 372 <TopLine Value="1"/> … … 381 379 <Filename Value="../Specialized/StackString.pas"/> 382 380 <UnitName Value="StackString"/> 383 <EditorIndex Value="2 5"/>381 <EditorIndex Value="26"/> 384 382 <WindowIndex Value="0"/> 385 383 <TopLine Value="1"/> … … 390 388 <Unit37> 391 389 <Filename Value="../Generic/StackImplementation.tpl"/> 392 <EditorIndex Value="2 6"/>390 <EditorIndex Value="27"/> 393 391 <WindowIndex Value="0"/> 394 392 <TopLine Value="1"/> … … 504 502 <Unit50> 505 503 <Filename Value="../Generic/SetInterface.tpl"/> 506 <EditorIndex Value=" 5"/>504 <EditorIndex Value="6"/> 507 505 <WindowIndex Value="0"/> 508 506 <TopLine Value="1"/> … … 515 513 <Filename Value="../Specialized/SetChar.pas"/> 516 514 <UnitName Value="SetChar"/> 517 <EditorIndex Value=" 6"/>515 <EditorIndex Value="7"/> 518 516 <WindowIndex Value="0"/> 519 517 <TopLine Value="1"/> … … 524 522 <Unit52> 525 523 <Filename Value="../Generic/SetImplementation.tpl"/> 526 <EditorIndex Value=" 4"/>524 <EditorIndex Value="5"/> 527 525 <WindowIndex Value="0"/> 528 526 <TopLine Value="1"/> … … 534 532 <Unit53> 535 533 <Filename Value="../Generic/RangeInterface.tpl"/> 536 <EditorIndex Value=" 8"/>534 <EditorIndex Value="9"/> 537 535 <WindowIndex Value="0"/> 538 536 <TopLine Value="1"/> … … 545 543 <Filename Value="../Specialized/RangeDateTime.pas"/> 546 544 <UnitName Value="RangeDateTime"/> 547 <EditorIndex Value=" 9"/>545 <EditorIndex Value="10"/> 548 546 <WindowIndex Value="0"/> 549 547 <TopLine Value="1"/> … … 562 560 <Unit56> 563 561 <Filename Value="../Generic/RangeImplementation.tpl"/> 564 <EditorIndex Value="1 0"/>562 <EditorIndex Value="11"/> 565 563 <WindowIndex Value="0"/> 566 564 <TopLine Value="1"/> … … 573 571 <Filename Value="../Specialized/ListVariant.pas"/> 574 572 <UnitName Value="ListVariant"/> 575 <EditorIndex Value=" 7"/>573 <EditorIndex Value="8"/> 576 574 <WindowIndex Value="0"/> 577 575 <TopLine Value="2"/> … … 593 591 <Filename Value="../Specialized/ListByte.pas"/> 594 592 <UnitName Value="ListByte"/> 595 <EditorIndex Value="1 4"/>593 <EditorIndex Value="15"/> 596 594 <WindowIndex Value="0"/> 597 595 <TopLine Value="1"/> … … 669 667 <Unit68> 670 668 <Filename Value="/usr/share/fpcsrc/rtl/inc/objpash.inc"/> 671 <EditorIndex Value="1 6"/>669 <EditorIndex Value="17"/> 672 670 <WindowIndex Value="0"/> 673 671 <TopLine Value="160"/> … … 677 675 <DefaultSyntaxHighlighter Value="Delphi"/> 678 676 </Unit68> 677 <Unit69> 678 <Filename Value="/usr/share/fpcsrc/rtl/objpas/classes/stringl.inc"/> 679 <EditorIndex Value="3"/> 680 <WindowIndex Value="0"/> 681 <TopLine Value="199"/> 682 <CursorPos X="3" Y="205"/> 683 <UsageCount Value="10"/> 684 <Loaded Value="True"/> 685 <DefaultSyntaxHighlighter Value="Delphi"/> 686 </Unit69> 679 687 </Units> 680 <JumpHistory Count="30" HistoryIndex="2 9">688 <JumpHistory Count="30" HistoryIndex="28"> 681 689 <Position1> 682 <Filename Value=" ../Specialized/ListObject.pas"/>683 <Caret Line=" 25" Column="24" TopLine="18"/>690 <Filename Value="UMainForm.pas"/> 691 <Caret Line="374" Column="10" TopLine="344"/> 684 692 </Position1> 685 693 <Position2> 686 <Filename Value=" /usr/share/fpcsrc/packages/fcl-base/src/contnrs.pp"/>687 <Caret Line=" 72" Column="26" TopLine="60"/>694 <Filename Value="UMainForm.pas"/> 695 <Caret Line="415" Column="1" TopLine="386"/> 688 696 </Position2> 689 697 <Position3> 690 <Filename Value=" /usr/share/fpcsrc/rtl/objpas/classes/lists.inc"/>691 <Caret Line=" 585" Column="9" TopLine="580"/>698 <Filename Value="UMainForm.pas"/> 699 <Caret Line="367" Column="1" TopLine="351"/> 692 700 </Position3> 693 701 <Position4> 694 <Filename Value=" ../Generic/ListImplementation.tpl"/>695 <Caret Line="3 45" Column="5" TopLine="342"/>702 <Filename Value="UMainForm.pas"/> 703 <Caret Line="368" Column="1" TopLine="351"/> 696 704 </Position4> 697 705 <Position5> 698 <Filename Value=" ../Generic/ListInterface.tpl"/>699 <Caret Line=" 55" Column="60" TopLine="27"/>706 <Filename Value="UMainForm.pas"/> 707 <Caret Line="363" Column="9" TopLine="341"/> 700 708 </Position5> 701 709 <Position6> 702 <Filename Value=" ../Specialized/ListObject.pas"/>703 <Caret Line=" 54" Column="28" TopLine="26"/>710 <Filename Value="UMainForm.pas"/> 711 <Caret Line="366" Column="7" TopLine="341"/> 704 712 </Position6> 705 713 <Position7> 706 <Filename Value=" ../Specialized/ListObject.pas"/>707 <Caret Line=" 26" Column="20" TopLine="9"/>714 <Filename Value="UMainForm.pas"/> 715 <Caret Line="367" Column="1" TopLine="341"/> 708 716 </Position7> 709 717 <Position8> 710 <Filename Value=" ../Specialized/ListObject.pas"/>711 <Caret Line=" 19" Column="27" TopLine="9"/>718 <Filename Value="UMainForm.pas"/> 719 <Caret Line="368" Column="1" TopLine="341"/> 712 720 </Position8> 713 721 <Position9> 714 <Filename Value=" Demo.lpr"/>715 <Caret Line=" 11" Column="10" TopLine="1"/>722 <Filename Value="UMainForm.pas"/> 723 <Caret Line="364" Column="18" TopLine="348"/> 716 724 </Position9> 717 725 <Position10> 718 <Filename Value=" Demo.lpr"/>719 <Caret Line=" 10" Column="38" TopLine="1"/>726 <Filename Value="UMainForm.pas"/> 727 <Caret Line="345" Column="5" TopLine="329"/> 720 728 </Position10> 721 729 <Position11> 722 <Filename Value=" Demo.lpr"/>723 <Caret Line=" 15" Column="1" TopLine="1"/>730 <Filename Value="UMainForm.pas"/> 731 <Caret Line="346" Column="14" TopLine="329"/> 724 732 </Position11> 725 733 <Position12> 726 <Filename Value=" Demo.lpr"/>727 <Caret Line=" 10" Column="20" TopLine="1"/>734 <Filename Value="UMainForm.pas"/> 735 <Caret Line="411" Column="23" TopLine="383"/> 728 736 </Position12> 729 737 <Position13> 730 <Filename Value=" Demo.lpr"/>731 <Caret Line=" 16" Column="3" TopLine="1"/>738 <Filename Value="UMainForm.pas"/> 739 <Caret Line="407" Column="21" TopLine="383"/> 732 740 </Position13> 733 741 <Position14> 734 742 <Filename Value="UMainForm.pas"/> 735 <Caret Line=" 87" Column="15" TopLine="77"/>743 <Caret Line="376" Column="19" TopLine="349"/> 736 744 </Position14> 737 745 <Position15> 738 <Filename Value="../ Specialized/ListObject.pas"/>739 <Caret Line=" 56" Column="3" TopLine="28"/>746 <Filename Value="../Generic/DictionaryInterface.tpl"/> 747 <Caret Line="26" Column="13" TopLine="1"/> 740 748 </Position15> 741 749 <Position16> 742 <Filename Value="../ Specialized/ListObject.pas"/>743 <Caret Line=" 49" Column="14" TopLine="28"/>750 <Filename Value="../Generic/DictionaryImplementation.tpl"/> 751 <Caret Line="6" Column="3" TopLine="4"/> 744 752 </Position16> 745 753 <Position17> 746 <Filename Value=" ../Specialized/ListObject.pas"/>747 <Caret Line=" 56" Column="12" TopLine="28"/>754 <Filename Value="UMainForm.pas"/> 755 <Caret Line="373" Column="8" TopLine="349"/> 748 756 </Position17> 749 757 <Position18> 750 <Filename Value=" ../Generic/ListInterface.tpl"/>751 <Caret Line=" 54" Column="46" TopLine="26"/>758 <Filename Value="UMainForm.pas"/> 759 <Caret Line="412" Column="1" TopLine="383"/> 752 760 </Position18> 753 761 <Position19> 754 <Filename Value=" Demo.lpr"/>755 <Caret Line=" 8" Column="26" TopLine="1"/>762 <Filename Value="UMainForm.pas"/> 763 <Caret Line="427" Column="24" TopLine="399"/> 756 764 </Position19> 757 765 <Position20> 758 <Filename Value=" ../Specialized/ListObject.pas"/>759 <Caret Line="5 1" Column="11" TopLine="28"/>766 <Filename Value="/usr/share/fpcsrc/rtl/objpas/classes/classesh.inc"/> 767 <Caret Line="582" Column="53" TopLine="564"/> 760 768 </Position20> 761 769 <Position21> 762 <Filename Value=" ../Specialized/ListObject.pas"/>763 <Caret Line="5 6" Column="1" TopLine="28"/>770 <Filename Value="/usr/share/fpcsrc/rtl/objpas/classes/classesh.inc"/> 771 <Caret Line="581" Column="57" TopLine="564"/> 764 772 </Position21> 765 773 <Position22> 766 <Filename Value=" UMainForm.pas"/>767 <Caret Line=" 94" Column="9" TopLine="77"/>774 <Filename Value="/usr/share/fpcsrc/rtl/objpas/classes/classesh.inc"/> 775 <Caret Line="579" Column="53" TopLine="564"/> 768 776 </Position22> 769 777 <Position23> 770 <Filename Value=" UMainForm.pas"/>771 <Caret Line=" 96" Column="7" TopLine="77"/>778 <Filename Value="/usr/share/fpcsrc/rtl/objpas/classes/stringl.inc"/> 779 <Caret Line="183" Column="8" TopLine="177"/> 772 780 </Position23> 773 781 <Position24> 774 <Filename Value=" ../Specialized/ListObject.pas"/>775 <Caret Line=" 25" Column="30" TopLine="11"/>782 <Filename Value="/usr/share/fpcsrc/rtl/objpas/classes/classesh.inc"/> 783 <Caret Line="575" Column="71" TopLine="551"/> 776 784 </Position24> 777 785 <Position25> 778 <Filename Value=" ../Specialized/ListObject.pas"/>779 <Caret Line="4 9" Column="45" TopLine="33"/>786 <Filename Value="UMainForm.pas"/> 787 <Caret Line="427" Column="58" TopLine="399"/> 780 788 </Position25> 781 789 <Position26> 782 790 <Filename Value="UMainForm.pas"/> 783 <Caret Line=" 299" Column="17" TopLine="272"/>791 <Caret Line="367" Column="12" TopLine="350"/> 784 792 </Position26> 785 793 <Position27> 786 794 <Filename Value="UMainForm.pas"/> 787 <Caret Line=" 247" Column="19" TopLine="238"/>795 <Caret Line="428" Column="7" TopLine="411"/> 788 796 </Position27> 789 797 <Position28> 790 798 <Filename Value="UMainForm.pas"/> 791 <Caret Line=" 273" Column="62" TopLine="257"/>799 <Caret Line="349" Column="3" TopLine="332"/> 792 800 </Position28> 793 801 <Position29> 794 802 <Filename Value="UMainForm.pas"/> 795 <Caret Line=" 319" Column="32" TopLine="292"/>803 <Caret Line="428" Column="35" TopLine="411"/> 796 804 </Position29> 797 805 <Position30> 798 <Filename Value=" UMainForm.pas"/>799 <Caret Line=" 258" Column="45" TopLine="241"/>806 <Filename Value="/usr/share/fpcsrc/rtl/objpas/classes/classesh.inc"/> 807 <Caret Line="575" Column="14" TopLine="558"/> 800 808 </Position30> 801 809 </JumpHistory> -
Generics/TemplateGenerics/Demo/UMainForm.lfm
r78 r80 15 15 Height = 25 16 16 Top = 8 17 Width = 1 1217 Width = 128 18 18 Caption = 'TListInteger' 19 19 OnClick = ButtonIntegerListClick … … 21 21 end 22 22 object MemoOutput: TMemo 23 Left = 1 2823 Left = 144 24 24 Height = 384 25 25 Top = 8 26 Width = 3 4426 Width = 328 27 27 Anchors = [akTop, akLeft, akRight, akBottom] 28 28 ReadOnly = True … … 34 34 Height = 25 35 35 Top = 40 36 Width = 1 1236 Width = 128 37 37 Caption = 'TListString' 38 38 OnClick = ButtonStringListClick … … 43 43 Height = 25 44 44 Top = 72 45 Width = 1 1245 Width = 128 46 46 Caption = 'TDictionaryString' 47 47 OnClick = ButtonDictionaryStringClick … … 52 52 Height = 25 53 53 Top = 102 54 Width = 1 1254 Width = 128 55 55 Caption = 'TQueueInteger' 56 56 OnClick = ButtonQueueIntegerClick … … 61 61 Height = 25 62 62 Top = 134 63 Width = 1 1563 Width = 129 64 64 Caption = 'TListChar(TString)' 65 65 OnClick = ButtonCharListClick 66 66 TabOrder = 5 67 67 end 68 object ButtonBenchmark : TButton69 Left = 1068 object ButtonBenchmarkList: TButton 69 Left = 8 70 70 Height = 25 71 Top = 35 072 Width = 1 1273 Caption = 'Benchmark '74 OnClick = ButtonBenchmark Click71 Top = 352 72 Width = 128 73 Caption = 'Benchmark list' 74 OnClick = ButtonBenchmarkListClick 75 75 TabOrder = 6 76 76 end … … 79 79 Height = 25 80 80 Top = 163 81 Width = 1 1381 Width = 129 82 82 Caption = 'TListObject' 83 83 OnClick = ButtonListObjectClick 84 84 TabOrder = 7 85 85 end 86 object ButtonBenchmarkDictionary: TButton 87 Left = 10 88 Height = 25 89 Top = 320 90 Width = 126 91 Caption = 'Benchmark dictionary' 92 OnClick = ButtonBenchmarkDictionaryClick 93 TabOrder = 8 94 end 86 95 end -
Generics/TemplateGenerics/Demo/UMainForm.pas
r79 r80 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 ComCtrls, ListInteger, ListString, DictionaryString , QueueInteger, ListChar,10 ListPointer, DateUtils, List Variant, Contnrs, ListObject;9 ComCtrls, ListInteger, ListString, DictionaryStringString, QueueInteger, ListChar, 10 ListPointer, DateUtils, ListObject; 11 11 12 12 type … … 15 15 16 16 TMainForm = class(TForm) 17 ButtonBenchmarkDictionary: TButton; 17 18 ButtonListObject: TButton; 18 ButtonBenchmark : TButton;19 ButtonBenchmarkList: TButton; 19 20 ButtonCharList: TButton; 20 21 ButtonQueueInteger: TButton; … … 23 24 ButtonStringList: TButton; 24 25 MemoOutput: TMemo; 25 procedure ButtonBenchmarkClick(Sender: TObject); 26 procedure ButtonBenchmarkDictionaryClick(Sender: TObject); 27 procedure ButtonBenchmarkListClick(Sender: TObject); 26 28 procedure ButtonCharListClick(Sender: TObject); 27 29 procedure ButtonDictionaryStringClick(Sender: TObject); … … 132 134 end; 133 135 134 function StringPairToStr(Pair: TPairString ): string;136 function StringPairToStr(Pair: TPairStringString): string; 135 137 begin 136 138 Result := Pair.Key + ':' + Pair.Value; … … 139 141 procedure TMainForm.ButtonDictionaryStringClick(Sender: TObject); 140 142 var 141 Dictionary: TDictionaryString ;143 Dictionary: TDictionaryStringString; 142 144 begin 143 145 MemoOutput.Clear; 144 146 WriteLn('TDictionaryString test'); 145 Dictionary := TDictionaryString .Create;147 Dictionary := TDictionaryStringString.Create; 146 148 with Dictionary do try 147 149 Add('Key1', 'Value1'); … … 193 195 end; 194 196 195 procedure TMainForm.ButtonBenchmark Click(Sender: TObject);197 procedure TMainForm.ButtonBenchmarkListClick(Sender: TObject); 196 198 var 197 199 List: TListPointer; … … 336 338 finally 337 339 List2.Free; 340 end; 341 end; 342 343 procedure TMainForm.ButtonBenchmarkDictionaryClick(Sender: TObject); 344 var 345 Dictionary: TDictionaryStringString; 346 Dictionary2: TStringList; 347 StartTime: TDateTime; 348 I: Integer; 349 R: string; 350 begin 351 MemoOutput.Clear; 352 try 353 Dictionary := TDictionaryStringString.Create; 354 WriteLn('TDictionaryStringString...'); 355 I := 0; 356 StartTime := Now; 357 repeat 358 Dictionary.Add(IntToStr(I), IntToStr(I)); 359 I := I + 1; 360 until (Now - StartTime) > OneSecond; 361 WriteLn('Add pair: ' + IntToStr(Dictionary.Count) + ' ops/sec'); 362 Application.ProcessMessages; 363 364 I := 0; 365 StartTime := Now; 366 repeat 367 R := Dictionary.Values[IntToStr(I mod Dictionary.Count)]; 368 I := I + 1; 369 until (Now - StartTime) > OneSecond; 370 WriteLn('Values: ' + IntToStr(I) + ' ops/sec'); 371 Application.ProcessMessages; 372 373 I := 0; 374 StartTime := Now; 375 repeat 376 R := Dictionary.Keys[I mod Dictionary.Count]; 377 I := I + 1; 378 until (Now - StartTime) > OneSecond; 379 WriteLn('Keys: ' + IntToStr(I) + ' ops/sec'); 380 Application.ProcessMessages; 381 382 I := 0; 383 StartTime := Now; 384 repeat 385 R := Dictionary.Items[I mod Dictionary.Count].Value; 386 I := I + 1; 387 until (Now - StartTime) > OneSecond; 388 WriteLn('Values by index: ' + IntToStr(I) + ' ops/sec'); 389 Application.ProcessMessages; 390 finally 391 Dictionary.Free; 392 end; 393 394 try 395 Dictionary2 := TStringList.Create; 396 Dictionary2.NameValueSeparator := '|'; 397 WriteLn('TStringList...'); 398 I := 0; 399 StartTime := Now; 400 repeat 401 Dictionary2.Add(IntToStr(I) + Dictionary2.NameValueSeparator + IntToStr(I)); 402 I := I + 1; 403 until (Now - StartTime) > OneSecond; 404 WriteLn('Add pair: ' + IntToStr(Dictionary2.Count) + ' ops/sec'); 405 Application.ProcessMessages; 406 407 I := 0; 408 StartTime := Now; 409 repeat 410 R := Dictionary2.Values[IntToStr(I mod Dictionary2.Count)]; 411 I := I + 1; 412 until (Now - StartTime) > OneSecond; 413 WriteLn('Values: ' + IntToStr(I) + ' ops/sec'); 414 Application.ProcessMessages; 415 416 I := 0; 417 StartTime := Now; 418 repeat 419 R := Dictionary2.Names[I mod Dictionary2.Count]; 420 I := I + 1; 421 until (Now - StartTime) > OneSecond; 422 WriteLn('Keys: ' + IntToStr(I) + ' ops/sec'); 423 Application.ProcessMessages; 424 425 I := 0; 426 StartTime := Now; 427 repeat 428 R := Dictionary2.ValueFromIndex[I mod Dictionary2.Count]; 429 I := I + 1; 430 until (Now - StartTime) > OneSecond; 431 WriteLn('Values by index: ' + IntToStr(I) + ' ops/sec'); 432 Application.ProcessMessages; 433 finally 434 Dictionary2.Free; 338 435 end; 339 436 end; -
Generics/TemplateGenerics/TemplateGenerics.lpk
r77 r80 79 79 </Item15> 80 80 <Item16> 81 <Filename Value="Specialized\DictionaryString .pas"/>82 <UnitName Value="DictionaryString "/>81 <Filename Value="Specialized\DictionaryStringString.pas"/> 82 <UnitName Value="DictionaryStringString"/> 83 83 </Item16> 84 84 <Item17> -
Generics/TemplateGenerics/TemplateGenerics.pas
r77 r80 9 9 uses 10 10 ListDouble, ListInteger, ListObject, ListPointer, ListString, TreeInteger, 11 TreeObject, TreePointer, TreeString, DictionaryString , StackDouble,11 TreeObject, TreePointer, TreeString, DictionaryStringString, StackDouble, 12 12 StackInteger, StackObject, StackPointer, StackString, QueueDouble, 13 13 QueueInteger, QueueObject, QueuePointer, QueueString, ListChar, ListVariant,
Note:
See TracChangeset
for help on using the changeset viewer.