- Timestamp:
- Jan 3, 2011, 7:30:09 AM (14 years ago)
- Location:
- Generics/TemplateGenerics/Demo
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Generics/TemplateGenerics/Demo/Demo.lpi
r109 r110 58 58 <EditorIndex Value="0"/> 59 59 <WindowIndex Value="0"/> 60 <TopLine Value=" 73"/>61 <CursorPos X=" 53" Y="79"/>60 <TopLine Value="404"/> 61 <CursorPos X="49" Y="419"/> 62 62 <UsageCount Value="233"/> 63 63 <Bookmarks Count="1"> … … 311 311 <Unit32> 312 312 <Filename Value="../Generic/GenericList.inc"/> 313 <EditorIndex Value=" 6"/>313 <EditorIndex Value="2"/> 314 314 <WindowIndex Value="0"/> 315 315 <TopLine Value="170"/> … … 416 416 </Unit45> 417 417 <Unit46> 418 <Filename Value="../Specialized/SpecializedList.pas"/> 419 <UnitName Value="SpecializedList"/> 420 <EditorIndex Value="7"/> 421 <WindowIndex Value="0"/> 422 <TopLine Value="161"/> 423 <CursorPos X="17" Y="287"/> 424 <UsageCount Value="102"/> 425 <Loaded Value="True"/> 426 </Unit46> 427 <Unit47> 428 <Filename Value="../Generic/GenericMatrix.inc"/> 429 <EditorIndex Value="8"/> 418 <Filename Value="../Generic/GenericMatrix.inc"/> 419 <EditorIndex Value="3"/> 430 420 <WindowIndex Value="0"/> 431 421 <TopLine Value="311"/> … … 433 423 <UsageCount Value="103"/> 434 424 <Loaded Value="True"/> 435 </Unit4 7>436 <Unit4 8>425 </Unit46> 426 <Unit47> 437 427 <Filename Value="../../../../../lazarus/trunk/lcl/graphics.pp"/> 438 428 <UnitName Value="Graphics"/> … … 441 431 <CursorPos X="37" Y="2636"/> 442 432 <UsageCount Value="90"/> 443 </Unit4 8>444 <Unit4 9>433 </Unit47> 434 <Unit48> 445 435 <Filename Value="../../../../../lazarus/trunk/lcl/interfaces/carbon/issues.xml"/> 446 436 <WindowIndex Value="0"/> … … 449 439 <UsageCount Value="6"/> 450 440 <DefaultSyntaxHighlighter Value="XML"/> 451 </Unit4 9>452 <Unit 50>441 </Unit48> 442 <Unit49> 453 443 <Filename Value="/usr/share/fpcsrc/rtl/objpas/classes/classesh.inc"/> 454 <EditorIndex Value="2"/>455 444 <WindowIndex Value="0"/> 456 445 <TopLine Value="199"/> 457 446 <CursorPos X="14" Y="213"/> 458 447 <UsageCount Value="28"/> 459 <Loaded Value="True"/> 460 </Unit50> 461 <Unit51> 448 </Unit49> 449 <Unit50> 462 450 <Filename Value="/usr/share/fpcsrc/rtl/objpas/classes/lists.inc"/> 463 <EditorIndex Value="5"/>464 451 <WindowIndex Value="0"/> 465 452 <TopLine Value="199"/> 466 453 <CursorPos X="3" Y="201"/> 467 454 <UsageCount Value="28"/> 468 <Loaded Value="True"/> 455 </Unit50> 456 <Unit51> 457 <Filename Value="../Generic/GenericListObject.inc"/> 458 <WindowIndex Value="0"/> 459 <TopLine Value="1"/> 460 <CursorPos X="21" Y="20"/> 461 <UsageCount Value="19"/> 469 462 </Unit51> 470 463 <Unit52> 471 <Filename Value="../Generic/GenericListObject.inc"/> 472 <WindowIndex Value="0"/> 473 <TopLine Value="1"/> 474 <CursorPos X="21" Y="20"/> 475 <UsageCount Value="19"/> 464 <Filename Value="/usr/share/fpcsrc/rtl/objpas/objpas.pp"/> 465 <UnitName Value="objpas"/> 466 <WindowIndex Value="0"/> 467 <TopLine Value="1"/> 468 <CursorPos X="27" Y="26"/> 469 <UsageCount Value="28"/> 476 470 </Unit52> 477 471 <Unit53> 478 <Filename Value="/usr/share/fpcsrc/rtl/objpas/objpas.pp"/>479 <UnitName Value="objpas"/>480 <EditorIndex Value="3"/>481 <WindowIndex Value="0"/>482 <TopLine Value="1"/>483 <CursorPos X="27" Y="26"/>484 <UsageCount Value="28"/>485 <Loaded Value="True"/>486 </Unit53>487 <Unit54>488 472 <Filename Value="/usr/share/fpcsrc/rtl/inc/systemh.inc"/> 489 <EditorIndex Value="4"/>490 473 <WindowIndex Value="0"/> 491 474 <TopLine Value="381"/> 492 475 <CursorPos X="3" Y="398"/> 493 476 <UsageCount Value="28"/> 494 <Loaded Value="True"/> 495 </Unit54> 496 <Unit55> 477 </Unit53> 478 <Unit54> 497 479 <Filename Value="/usr/share/fpcsrc/rtl/inc/varianth.inc"/> 498 480 <WindowIndex Value="0"/> … … 500 482 <CursorPos X="10" Y="503"/> 501 483 <UsageCount Value="7"/> 502 </Unit5 5>503 <Unit5 6>484 </Unit54> 485 <Unit55> 504 486 <Filename Value="../../../../../lazarus/trunk/lcl/include/control.inc"/> 505 <EditorIndex Value="1"/>506 487 <WindowIndex Value="0"/> 507 488 <TopLine Value="2270"/> 508 489 <CursorPos X="22" Y="2273"/> 509 490 <UsageCount Value="19"/> 510 <Loaded Value="True"/> 511 </Unit56> 512 <Unit57> 491 </Unit55> 492 <Unit56> 513 493 <Filename Value="../Specialized/SpecializedMatrix.pas"/> 514 494 <UnitName Value="SpecializedMatrix"/> 515 <EditorIndex Value=" 9"/>495 <EditorIndex Value="4"/> 516 496 <WindowIndex Value="0"/> 517 497 <TopLine Value="31"/> … … 519 499 <UsageCount Value="18"/> 520 500 <Loaded Value="True"/> 501 </Unit56> 502 <Unit57> 503 <Filename Value="../ReadMe.txt"/> 504 <WindowIndex Value="0"/> 505 <TopLine Value="1"/> 506 <CursorPos X="28" Y="10"/> 507 <UsageCount Value="9"/> 508 <DefaultSyntaxHighlighter Value="None"/> 521 509 </Unit57> 522 510 <Unit58> 523 <Filename Value="../ReadMe.txt"/> 524 <WindowIndex Value="0"/> 525 <TopLine Value="1"/> 526 <CursorPos X="28" Y="10"/> 527 <UsageCount Value="9"/> 528 <DefaultSyntaxHighlighter Value="None"/> 511 <Filename Value="../../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/dateutil.inc"/> 512 <EditorIndex Value="1"/> 513 <WindowIndex Value="0"/> 514 <TopLine Value="38"/> 515 <CursorPos X="3" Y="50"/> 516 <UsageCount Value="10"/> 517 <Loaded Value="True"/> 529 518 </Unit58> 530 519 </Units> … … 623 612 </Position23> 624 613 <Position24> 625 <Filename Value=" /usr/share/fpcsrc/rtl/objpas/classes/lists.inc"/>626 <Caret Line=" 679" Column="23" TopLine="677"/>614 <Filename Value="../Generic/GenericList.inc"/> 615 <Caret Line="193" Column="31" TopLine="180"/> 627 616 </Position24> 628 617 <Position25> 629 618 <Filename Value="../Generic/GenericList.inc"/> 630 <Caret Line="1 93" Column="31" TopLine="180"/>619 <Caret Line="184" Column="20" TopLine="170"/> 631 620 </Position25> 632 621 <Position26> 633 <Filename Value="../ Specialized/SpecializedList.pas"/>634 <Caret Line="1 04" Column="1" TopLine="1"/>622 <Filename Value="../Generic/GenericList.inc"/> 623 <Caret Line="184" Column="19" TopLine="170"/> 635 624 </Position26> 636 625 <Position27> 637 <Filename Value=" ../Specialized/SpecializedList.pas"/>638 <Caret Line=" 296" Column="1" TopLine="269"/>626 <Filename Value="UMainForm.pas"/> 627 <Caret Line="42" Column="51" TopLine="20"/> 639 628 </Position27> 640 629 <Position28> 641 <Filename Value=" ../Generic/GenericList.inc"/>642 <Caret Line=" 184" Column="20" TopLine="170"/>630 <Filename Value="UMainForm.pas"/> 631 <Caret Line="458" Column="36" TopLine="440"/> 643 632 </Position28> 644 633 <Position29> 645 <Filename Value=" ../Specialized/SpecializedList.pas"/>646 <Caret Line=" 296" Column="1" TopLine="269"/>634 <Filename Value="UMainForm.pas"/> 635 <Caret Line="7" Column="52" TopLine="1"/> 647 636 </Position29> 648 637 <Position30> 649 <Filename Value=" ../Generic/GenericList.inc"/>650 <Caret Line=" 184" Column="19" TopLine="170"/>638 <Filename Value="UMainForm.pas"/> 639 <Caret Line="526" Column="1" TopLine="502"/> 651 640 </Position30> 652 641 </JumpHistory> -
Generics/TemplateGenerics/Demo/UMainForm.lfm
r109 r110 10 10 OnCreate = FormCreate 11 11 OnDestroy = FormDestroy 12 LCLVersion = '0.9. 29'12 LCLVersion = '0.9.31' 13 13 object ButtonIntegerList: TButton 14 14 Left = 8 -
Generics/TemplateGenerics/Demo/UMainForm.pas
r109 r110 39 39 private 40 40 public 41 MeasureDuration: TDateTime; 41 42 Bitmap: TBitmap; 43 procedure UpdateButtonState(Enabled: Boolean); 42 44 procedure WriteOutput(Text1: string = ''; Text2: string = ''); 43 45 end; … … 54 56 procedure TMainForm.FormCreate(Sender: TObject); 55 57 begin 58 MeasureDuration := 100 * OneMillisecond; 56 59 end; 57 60 … … 236 239 ListViewOutput.Clear; 237 240 try 241 UpdateButtonState(False); 238 242 List := TListPointer.Create; 239 243 List2 := TList.Create; … … 242 246 repeat 243 247 List.Add(1); 244 until (Now - StartTime) > OneSecond;248 until (Now - StartTime) > MeasureDuration; 245 249 WriteOutput('TListPointer.Add', IntToStr(List.Count) + ' ops/sec'); 246 250 List.Clear; … … 250 254 repeat 251 255 List2.Add(1); 252 until (Now - StartTime) > OneSecond;256 until (Now - StartTime) > MeasureDuration; 253 257 WriteOutput('TList.Add', IntToStr(List2.Count) + ' ops/sec'); 254 258 List2.Clear; … … 258 262 repeat 259 263 List.Insert(0, 1); 260 until (Now - StartTime) > OneSecond;264 until (Now - StartTime) > MeasureDuration; 261 265 WriteOutput('TListPointer.Insert', IntToStr(List.Count) + ' ops/sec'); 262 266 List.Clear; … … 266 270 repeat 267 271 List2.Insert(0, 1); 268 until (Now - StartTime) > OneSecond;272 until (Now - StartTime) > MeasureDuration; 269 273 WriteOutput('TList.Insert', IntToStr(List2.Count) + ' ops/sec'); 270 274 List2.Clear; … … 278 282 List.Delete(0); 279 283 Inc(I); 280 until (Now - StartTime) > OneSecond;284 until (Now - StartTime) > MeasureDuration; 281 285 WriteOutput('TListPointer.Delete', IntToStr(I) + ' ops/sec'); 282 286 List.Clear; … … 290 294 List2.Delete(0); 291 295 Inc(I); 292 until (Now - StartTime) > OneSecond;296 until (Now - StartTime) > MeasureDuration; 293 297 WriteOutput('TList.Delete', IntToStr(I) + ' ops/sec'); 294 298 Application.ProcessMessages; … … 301 305 List.Move(300000, 700000); 302 306 Inc(I); 303 until (Now - StartTime) > OneSecond;307 until (Now - StartTime) > MeasureDuration; 304 308 WriteOutput('TListPointer.Move', IntToStr(I) + ' ops/sec'); 305 309 List.Clear; … … 313 317 List2.Move(300000, 700000); 314 318 Inc(I); 315 until (Now - StartTime) > OneSecond;319 until (Now - StartTime) > MeasureDuration; 316 320 WriteOutput('TList.Move', IntToStr(I) + ' ops/sec'); 317 321 Application.ProcessMessages; … … 324 328 List.Exchange(300000, 700000); 325 329 Inc(I); 326 until (Now - StartTime) > OneSecond;330 until (Now - StartTime) > MeasureDuration; 327 331 WriteOutput('TListPointer.Exchange', IntToStr(I) + ' ops/sec'); 328 332 List.Clear; … … 336 340 List2.Exchange(300000, 700000); 337 341 Inc(I); 338 until (Now - StartTime) > OneSecond;342 until (Now - StartTime) > MeasureDuration; 339 343 WriteOutput('TList.Exchange', IntToStr(I) + ' ops/sec'); 340 344 Application.ProcessMessages; … … 347 351 List.IndexOf(Pointer(I mod List.Count)); 348 352 Inc(I); 349 until (Now - StartTime) > OneSecond;353 until (Now - StartTime) > MeasureDuration; 350 354 WriteOutput('TListPointer.IndexOf', IntToStr(I) + ' ops/sec'); 351 355 List.Clear; … … 359 363 List2.IndexOf(Pointer(I mod List2.Count)); 360 364 Inc(I); 361 until (Now - StartTime) > OneSecond;365 until (Now - StartTime) > MeasureDuration; 362 366 WriteOutput('TList.IndexOf', IntToStr(I) + ' ops/sec'); 363 367 Application.ProcessMessages; 364 368 365 369 finally 370 UpdateButtonState(True); 366 371 List.Free; 367 372 List2.Free; … … 380 385 ListViewOutput.Clear; 381 386 try 387 UpdateButtonState(False); 382 388 Dictionary := TDictionaryStringString.Create; 383 389 Dictionary2 := TStringList.Create; … … 389 395 Dictionary.Add(IntToStr(I), IntToStr(I)); 390 396 I := I + 1; 391 until (Now - StartTime) > OneSecond;397 until (Now - StartTime) > MeasureDuration; 392 398 WriteOutput('TDictionaryStringString.Add', IntToStr(Dictionary.Count) + ' ops/sec'); 393 399 Application.ProcessMessages; … … 398 404 Dictionary2.Add(IntToStr(I) + Dictionary2.NameValueSeparator + IntToStr(I)); 399 405 I := I + 1; 400 until (Now - StartTime) > OneSecond;406 until (Now - StartTime) > MeasureDuration; 401 407 WriteOutput('TStringList.Add', IntToStr(Dictionary2.Count) + ' ops/sec'); 402 408 Application.ProcessMessages; … … 407 413 R := Dictionary.Values[IntToStr(I mod Dictionary.Count)]; 408 414 I := I + 1; 409 until (Now - StartTime) > OneSecond;415 until (Now - StartTime) > MeasureDuration; 410 416 WriteOutput('TDictionaryStringString.Values', IntToStr(I) + ' ops/sec'); 411 417 Application.ProcessMessages; … … 416 422 R := Dictionary2.Values[IntToStr(I mod Dictionary2.Count)]; 417 423 I := I + 1; 418 until (Now - StartTime) > OneSecond;424 until (Now - StartTime) > MeasureDuration; 419 425 WriteOutput('TStringList.Values', IntToStr(I) + ' ops/sec'); 420 426 Application.ProcessMessages; … … 425 431 R := Dictionary.Keys[I mod Dictionary.Count]; 426 432 I := I + 1; 427 until (Now - StartTime) > OneSecond;433 until (Now - StartTime) > MeasureDuration; 428 434 WriteOutput('TDictionaryStringString.Keys', IntToStr(I) + ' ops/sec'); 429 435 Application.ProcessMessages; … … 434 440 R := Dictionary2.Names[I mod Dictionary2.Count]; 435 441 I := I + 1; 436 until (Now - StartTime) > OneSecond;442 until (Now - StartTime) > MeasureDuration; 437 443 WriteOutput('TStringList.Keys(Names)', IntToStr(I) + ' ops/sec'); 438 444 Application.ProcessMessages; … … 443 449 R := Dictionary.Items[I mod Dictionary.Count].Value; 444 450 I := I + 1; 445 until (Now - StartTime) > OneSecond;451 until (Now - StartTime) > MeasureDuration; 446 452 WriteOutput('TDictionaryStringString.Items', IntToStr(I) + ' ops/sec'); 447 453 Application.ProcessMessages; … … 452 458 R := Dictionary2.ValueFromIndex[I mod Dictionary2.Count]; 453 459 I := I + 1; 454 until (Now - StartTime) > OneSecond;460 until (Now - StartTime) > MeasureDuration; 455 461 WriteOutput('TStringList.Items(ValueFromIndex)', IntToStr(I) + ' ops/sec'); 456 462 Application.ProcessMessages; 457 463 458 464 finally 465 UpdateButtonState(True); 459 466 Dictionary.Free; 460 467 Dictionary2.Free; … … 494 501 end; 495 502 503 procedure TMainForm.UpdateButtonState(Enabled: Boolean); 504 begin 505 ButtonBenchmarkDictionary.Enabled := Enabled; 506 ButtonBenchmarkList.Enabled := Enabled; 507 ButtonCharList.Enabled := Enabled; 508 ButtonDictionaryString.Enabled := Enabled; 509 ButtonIntegerList.Enabled := Enabled; 510 ButtonListObject.Enabled := Enabled; 511 ButtonMatrixInteger.Enabled := Enabled; 512 ButtonQueueInteger.Enabled := Enabled; 513 ButtonStringList.Enabled := Enabled; 514 end; 515 496 516 procedure TMainForm.WriteOutput(Text1: string = ''; Text2: string = ''); 497 517 var
Note:
See TracChangeset
for help on using the changeset viewer.