Leaderboard
Popular Content
Showing content with the highest reputation on 09/13/24 in Posts
-
TParallelArray Sort Performance...
Lajos Juhász replied to Steve Maughan's topic in RTL and Delphi Object Pascal
Stefan you should give at least 48 hours to a new version before you break it. It does handle array of 100_000 integers. Maybe for a larger arrays you have to buy a special SKU for sorting. -
https://www.youtube.com/watch?v=E73cMk856xM&list=PLwUPJvR9mZHisbPqXfMYk6JOzx_5IF_k6&index=1 https://youtu.be/E73cMk856xM?list=PLwUPJvR9mZHisbPqXfMYk6JOzx_5IF_k6
-
TParallelArray Sort Performance...
Anders Melander replied to Steve Maughan's topic in RTL and Delphi Object Pascal
But it crashed faster and fast is better, right? Right? If only there was some easy way of getting stuff like this tested before release... I mean, come on, we all make bugs but this is simply not acceptable. -
New Warning in 12.2: Overloading a similar index type by declaring an array property 'Items'
Uwe Raabe replied to pyscripter's topic in RTL and Delphi Object Pascal
Yep! I first made use of that almost 10 years ago in a class holding translation strings. Before that the strings were indexed by an Integer, but later we extended that to string indices. property Items[Index: Integer]: string read GetItems; default; property Items[const Index: string]: string read GetItems; default; The interesting part was that both are marked as default properties, which allowed us to simply write something like this: Label1.Caption := Translations[42]; Label2.Caption := Translations['Error']; The most benefit came from the fact that we could keep the Integer based translations and simply add the string based ones - all using the same Translations instance. -
Which version is applicable to receive Delphi updates and upgrade versions?
JohnLM replied to JohnLM's topic in Delphi IDE and APIs
Update. . . Success! I made contact with my sales rep and I am now able to download the 12.2 iso. -
So they assume that user using the Pro version do not create large projects? I think its more a money thing again.
-
Delphi takes 9 seconds to start/shutdown an empty application
Brian Evans replied to FreeDelphiPascal's topic in General Help
I found that annoying as well. For several years I would set the debug desktop to the regular desktop and turn off hide designers on run. Made compile/run/test cycles much faster. I usually did not need the debug panels as most testing was in the application being developed. No longer needed with very recent versions as IDE redrawing is better so switching desktops and hiding/unhiding designers is fast. -
TParallelArray Sort Performance...
Stefan Glienke replied to Steve Maughan's topic in RTL and Delphi Object Pascal
This is the benchmark code - previous results I posted were with TTestType = Integer, but using Double shows similar results (I ran the benchmark as 64bit release) program SortBench; {$APPTYPE CONSOLE} uses System.Generics.Collections, Spring, Spring.Comparers, Spring.Benchmark, System.SysUtils; type TTestType = Double; TDistFunc = function(size: Integer): TArray<TTestType>; TSortFunc = procedure(var values: array of TTestType); function IntToTestType(i: Integer): TTestType; begin Result := i; end; function Equals(const left, right: TTestType): Boolean; inline; begin Result := left = right; end; function Shuffled(size: Integer): TArray<TTestType>; var i: Integer; begin SetLength(Result, size); for i := 0 to size - 1 do Result[i] := IntToTestType(i); Spring.TArray.Shuffle<TTestType>(Result); end; function Shuffled_16Values(size: Integer): TArray<TTestType>; var i: Integer; begin SetLength(Result, size); for i := 0 to size - 1 do Result[i] := IntToTestType(Random(16)); end; function TwoValues(size: Integer): TArray<TTestType>; var i: Integer; begin SetLength(Result, size); for i := 0 to size - 1 do Result[i] := IntToTestType(Random(2)); end; function AllEqual(size: Integer): TArray<TTestType>; var i: Integer; begin SetLength(Result, size); for i := 0 to size - 1 do Result[i] := IntToTestType(0); end; function Ascending(size: Integer): TArray<TTestType>; var i: Integer; begin SetLength(Result, size); for i := 0 to size - 1 do Result[i] := IntToTestType(i); end; function SlightlyScrambled(size: Integer): TArray<TTestType>; const scramblePercentage = 5; var i, idx1, idx2: Integer; temp: TTestType; scrambleCount: Integer; begin SetLength(Result, size); for i := 0 to size - 1 do Result[i] := IntToTestType(i); scrambleCount := size * scramblePercentage div 100; for i := 1 to scrambleCount do begin idx1 := Random(size); idx2 := Random(size); temp := Result[idx1]; Result[idx1] := Result[idx2]; Result[idx2] := temp; end; end; function SortedBlocks(size: Integer): TArray<TTestType>; type TBlock100 = array[1..100] of TTestType; TBlock10 = array[1..10] of TTestType; var i: Integer; begin SetLength(Result, size); for i := 0 to size - 1 do Result[i] := IntToTestType(i); if size > 100 then Spring.TArray.Shuffle<TBlock100>(Pointer(Result), (size div (SizeOf(TBlock100) div SizeOf(TTestType))) - 1) else Spring.TArray.Shuffle<TBlock10>(Pointer(Result), (size div (SizeOf(TBlock10) div SizeOf(TTestType))) - 1); end; function SingleBigSwap(size: Integer): TArray<TTestType>; var i: Integer; halfSize: Integer; begin SetLength(Result, size); halfSize := size div 2; for i := 0 to halfSize - 1 do Result[i] := IntToTestType(i + halfSize); for i := halfSize to size -1 do Result[i] := IntToTestType(i - halfSize); end; function Descending(size: Integer): TArray<TTestType>; var i: Integer; begin SetLength(Result, size); for i := size-1 downto 0 do Result[i] := IntToTestType(i); end; function PipeOrgan(size: Integer): TArray<TTestType>; var i: Integer; begin SetLength(Result, size); for i := 0 to (size div 2) - 1 do Result[i] := IntToTestType(i); for i := size div 2 to size -1 do Result[i] := IntToTestType(size - 1); end; function PushFront(size: Integer): TArray<TTestType>; var i: Integer; begin SetLength(Result, size); for i := 1 to size - 1 do Result[i - 1] := IntToTestType(i); Result[size - 1] := IntToTestType(0); end; function PushMiddle(size: Integer): TArray<TTestType>; var i: Integer; begin SetLength(Result, size); for i := 0 to (size div 2) - 1 do Result[i] := IntToTestType(i); for i := (size div 2) + 1 to size -1 do Result[i - 1] := IntToTestType(i); Result[size - 1] := IntToTestType(size div 2); end; procedure QuickSort(var values: array of TTestType); begin System.Generics.Collections.TArray.Sort<TTestType>(values); end; procedure QuickSort_SpringComparer(var values: array of TTestType); begin System.Generics.Collections.TArray.Sort<TTestType>(values , Spring.Comparers.TComparer<TTestType>.Default ); end; procedure IntroSort(var values: array of TTestType); begin Spring.TArray.Sort<TTestType>(values); end; const Distributions: array[0..11] of record name: string; func: TDistFunc end = ( (name: 'random'; func: Shuffled), (name: 'few_unique'; func: Shuffled_16Values), (name: 'two_values'; func: TwoValues), (name: 'all_equal'; func: AllEqual), (name: 'ascending'; func: Ascending), (name: 'slightly_scrambled'; func: SlightlyScrambled), (name: 'sorted_blocks'; func: SortedBlocks), (name: 'single_big_swap'; func: SingleBigSwap), (name: 'descending'; func: Descending), (name: 'pipe_organ'; func: PipeOrgan), (name: 'push_front'; func: PushFront), (name: 'push_middle'; func: PushMiddle) ); Sorts: array[0..2] of record name: string; func: TSortFunc end = ( (name: 'QuickSort'; func: QuickSort) ,(name: 'QuickSort2'; func: QuickSort_SpringComparer) ,(name: 'IntroSort'; func: IntroSort) ); Sizes: array of Integer = [100, 1000, 10000, 100000, 1000000]; procedure BenchSort(const state: TState); begin var distIdx := state[0]; var sortIdx := state[1]; var size := state[2]; var distribution: TDistFunc := Distributions[distIdx].func; var sort: TSortFunc := Sorts[sortIdx].func; var data := distribution(size); var copy: TArray<TTestType>; SetLength(copy, size); for var _ in state do begin state.PauseTiming; if IsManagedType(TTestType) then MoveManaged(data, copy, TypeInfo(TTestType), size) else Move(data[0], copy[0], size * SizeOf(TTestType)); state.ResumeTiming; sort(copy); end; QuickSort(data); for var i := 0 to high(copy) do Assert(Equals(copy[i], data[i]), Distributions[distIdx].Name + '/' + Sorts[sortIdx].Name + '/' + size.ToString); end; procedure Main; begin benchmark_format_args := False; for var distIdx := Low(distributions) to High(Distributions) do for var size in Sizes do for var sortIdx := Low(Sorts) to High(Sorts) do begin var bm := Benchmark(BenchSort, Distributions[distIdx].name + '/' + Sorts[sortIdx].name + '/count:' + size.ToString) .Args([distIdx, sortIdx, size]); bm.Iterations(100); end; Benchmark_Main; end; begin try Main; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; Readln; end. -
New Warning in 12.2: Overloading a similar index type by declaring an array property 'Items'
Lajos Juhász replied to pyscripter's topic in RTL and Delphi Object Pascal
I have checked this on D11.2 there is also both RTLVersion111 and RTLVersion112 defined. -
New Warning in 12.2: Overloading a similar index type by declaring an array property 'Items'
pyscripter replied to pyscripter's topic in RTL and Delphi Object Pascal
I ended up with the following, which is backward compatible and future proof: {$IF (CompilerVersion > 36) or Declared(RTLVersion122)}{$WARN OVERLOADING_ARRAY_PROPERTY OFF}{$ENDIF} property Items[Index : TColumnIndex] : TVirtualTreeColumn read GetItem write SetItem; default; property Header: TVTHeader read FHeader; property TrackIndex : TColumnIndex read FTrackIndex write FTrackIndex; property TreeView : TCustomControl read GetTreeView; property UpdateCount; {$IF (CompilerVersion > 36) or Declared(RTLVersion122)}{$WARN OVERLOADING_ARRAY_PROPERTY ON}{$ENDIF} end; Notes: If the $WARN OFF comes immediately after the Items declaration you still get the warning. Delphi 12.2 still defines RTLVersion121. Presumably if there is a Delphi 12.3 etc. RTLVersion122 will be defined. -
Delphi takes 9 seconds to start/shutdown an empty application
Anders Melander replied to FreeDelphiPascal's topic in General Help
The CPU alone would be enough to explain the difference. I'm guessing your old CPU was a AMD Ryzen 8700G which is 5-6 times faster than your new CPU. https://www.cpubenchmark.net/compare/2962vs5836/Intel-i5-7440HQ-vs-AMD-Ryzen-7-8700G In addition, the support circuits (all the stuff that's not the CPU), being laptop components, are most likely optimized for energy efficiency rather than performance. My own laptop, a Lenovo X1 Extreme, was at the time I bought it the fastest (and most expensive 😞 ) laptop Lenovo produced but the performance is still... meh.. not impressive. The RAM will also make a difference. Windows 10 will be able to handle 16Gb better than Windows 7 did but it's still on the lower side. I think the best thing you could do with this hardware is to add more memory. Depending on the current memory configuration you should be able to upgrade to 32Gb. If I was you I would spend my effort on fixing your old system. Replace the parts that are dead. If you limit yourself to parts (CPU/MB/RAM/GPU) that are a few years old you can build a really good system on the cheap. I reluctantly upgraded my main system from Windows 7 to 10 earlier this year. I had feared that it would kill the performance of my 10+ old system (Intel i5-2500K @ 3.30Ghz, 16Gb) but it actually performs pretty good. In many cases better than the old system did. -
Delphi bug reports or feature requests to "vote"/comment for (important, fatal etc)/
DelphiUdIT replied to Tommi Prami's topic in Delphi IDE and APIs
May be there is an evaluation error in the routine with negative TDateTime (less then year 1900 in "System.DateUtils" at line 3487 ... the operation should be "minus" if the date il older then 1900 .... Value := LDate + LTime; -
New Warning in 12.2: Overloading a similar index type by declaring an array property 'Items'
Jaska replied to pyscripter's topic in RTL and Delphi Object Pascal
I use this to make code compatible to previous versions. {$IFDEF VER360} {$IF Declared(RTLVersion122)} {$WARN OVERLOADING_ARRAY_PROPERTY OFF} {$IFEND} {$ENDIF} -
TParallelArray Sort Performance...
Stefan Glienke replied to Steve Maughan's topic in RTL and Delphi Object Pascal
I am not commenting on benchmark results without seeing the code - I have seen too many flawed benchmarks in my life. If you look into the implementation you see that it is using the most simple parallel quicksort imaginable - that means the first run over the entire array which arranges the elements according to the pivot (as in the TArray.Sort the most simple pivot selection - take the middle) runs single threaded. Only then the processing of left and right is being passed to the PPL. Anyone who has researched a bit into sorting algorithms in the past 20 years knows that a pure quicksort is hardly anything good enough to be used as general purpose sorting algo in a runtime - other languages using hybrids for years, .NET and some C++ runtimes use IntroSort, Python uses Timsort, so does Java for objects and some special version of QuickSort for primitive types, lately some languages such as Go adapted PDQSort as their default sorting algorithm. I'd argue that some of these better algorithms running single-threaded outperform parallel quicksort on certain and not so uncommon data patterns. -
New Warning in 12.2: Overloading a similar index type by declaring an array property 'Items'
Uwe Raabe replied to pyscripter's topic in RTL and Delphi Object Pascal
AFAIK, there is no legal syntax to avoid this warning. The only way I know of is locally suppressing it: ... {$WARN OVERLOADING_ARRAY_PROPERTY OFF} property Items[Index : TColumnIndex] : TVirtualTreeColumn read GetItem write SetItem; default; ... end; {$WARN OVERLOADING_ARRAY_PROPERTY DEFAULT}