Quote from: k1ng on August 04, 2019, 12:32:43 pmYour code is a complete different mode, so I guess it's not comparable at all with the previous posted codes.Due to the fact that RTL is compiled in OBJFPC mode, it is more logical to test it in the same mode.
Your code is a complete different mode, so I guess it's not comparable at all with the previous posted codes.
Quote from: ASerge on August 04, 2019, 12:45:44 pmQuote from: k1ng on August 04, 2019, 12:32:43 pmYour code is a complete different mode, so I guess it's not comparable at all with the previous posted codes.Due to the fact that RTL is compiled in OBJFPC mode, it is more logical to test it in the same mode.But the initial post uses $mode Delphi, so I'm sure he did that because he needs Delphi compatibility as most people do.Delphi 10.3.2 - 32bitCode: Text [Select][+][-]List populated - 100000 keys in 0 ticks.List populated - 1000000 keys in 0 ticks.List populated - 10000000 keys in 47 ticks.List populated - 100000000 keys in 438 ticks.-- out of memory for last comboDelphi 10.3.2 - 64bitCode: Text [Select][+][-]List populated - 100000 keys in 0 ticks.List populated - 1000000 keys in 0 ticks.List populated - 10000000 keys in 47 ticks.List populated - 100000000 keys in 453 ticks.List populated - 500000000 keys in 2328 ticks.ported code to work in Delphi:Code: Pascal [Select][+][-]program fclvsgc; {$apptype CONSOLE} uses SysUtils, Classes, windows, Generics.Defaults, Generics.Collections; type TData = array of Integer; var scl: Generics.Collections.TList<LongInt>; i: LongInt; cnt: LongInt; start: UInt64; function GenData(s: LongInt): TData;var I: Integer;begin SetLength(Result, s); for I := 0 to High(Result) do Result[I] := Random(2147483647);end; procedure PopulateList(s: LongInt);var Data: TData;begin Data := GenData(s); scl := Generics.Collections.TList<LongInt>.Create; scl.Capacity := s; start := GetTickCount64(); for i in Data do scl.Add(i); WriteLn('List populated - ', s, ' keys in ', GetTickCount64() - start, ' ticks.'); FreeAndNil(scl);end; begin cnt := 100000; PopulateList(cnt); cnt := 10*cnt; PopulateList(cnt); cnt := 10*cnt; PopulateList(cnt); cnt := 10*cnt; PopulateList(cnt); cnt := 5*cnt; PopulateList(cnt); WriteLn('End.'); readln;end.
...FPC 3.3.1 rev 42572...
Any Delphi (Community) vs FP Generics.Collections bench, test?