Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 02/16/20 in all areas

  1. It is not an issue, it is the cost benefit of higher performance x less memory. But the optimization of creating it with the capacity is valid considering that the performance increases is on average 30%, both for small collections and for large ones. uses System.SysUtils, System.Generics.Collections, System.Diagnostics, FMX.Dialogs; procedure TestWithInitialCapacity; var I, J, LNewId: Integer; LDictionary: TDictionary<Integer, Boolean>; LStopwatch: TStopwatch; begin LStopwatch := TStopwatch.StartNew; for I := 0 to 10000 do begin LDictionary := TDictionary<Integer, Boolean>.Create(200); for J := 0 to 100 do begin repeat LNewId := Random(High(Integer)); until not LDictionary.ContainsKey(LNewId); LDictionary.Add(LNewId, True); end; FreeAndNil(LDictionary); end; showmessage(Format('Test with initial capacity: %g', [LStopwatch.Elapsed.TotalMilliseconds])); end; procedure TestWithoutInitialCapacity; var I, J, LNewId: Integer; LDictionary: TDictionary<Integer, Boolean>; LStopwatch: TStopwatch; begin LStopwatch := TStopwatch.StartNew; for I := 0 to 10000 do begin LDictionary := TDictionary<Integer, Boolean>.Create; for J := 0 to 100 do begin repeat LNewId := Random(High(Integer)); until not LDictionary.ContainsKey(LNewId); LDictionary.Add(LNewId, True); end; FreeAndNil(LDictionary); end; showmessage(Format('Test without initial capacity: %g', [LStopwatch.Elapsed.TotalMilliseconds])); end;
  2. David Hoyle

    Problem reinstalling CodeSite 5

    I think you will need to add the installations Win32 directory to your path. I did this in the IDE (see below):
  3. I was not talking about making classes for UI controls but exposing your dataobjects in a way that you can bind them in some way to the UI. Personally I don't like LiveBindings that much - and I gave up on some MVVM-ish approach for Delphi. What works kinda well is going the DB aware approach with datasets (can use things like the TObjectDataSet from Spring4D or other similar ones - DevArt for example has also one) that just are adapters to non dataset/database data such as lists of objects. There are other approaches such as my TTreeViewPresenter that connects an IObjectList from Spring4D to a TVirtualStringTree to display and even edit data.
  4. erdoganozkaya

    Receiving incoming calls

    Thank you for your answer, could you please make a small example?
×