Leaderboard
Popular Content
Showing content with the highest reputation on 10/22/24 in Posts
-
That sounds more like Quantum Mechanics than Mathematics.
-
I very much like the "Filter Explicit properties" expert. However, in recent versions of Delphi (not sure when it started), the IDE inserts annoying DesignSize properties that "pollute" the Dfm and the revision history. It would be really nice if the expert was renamed "Filter DFM properties" and included the option of removing these DesignSize properties.
- 11 replies
-
Multiline string literals are actually supported by the GExperts code formatter. https://blog.dummzeuch.de/2023/11/26/gexperts-code-formatter-now-supports-multi-line-string-literals-but/ https://blog.dummzeuch.de/2023/12/04/that-was-easier-than-i-thought-yeah-right/ But there are some Generics constructs that it can't handle.
-
@PeterBelow It is even possible to inject new properties to the Object Inspector. In Cmon.DataSense.Design.pas I use this technique to add a DataSource and DataField property to supported controls. The additional data is stored in a special component (TDataSense) using a dictionary internally:
-
Suggestions for improving the display of tabs in the SourceCode editor
havrlisan replied to PeterPanettone's topic in Delphi IDE and APIs
Instead of hardcoding it like this and making it optional (which makes little sense), it would be better to fill the Tab Options (Options > Editor > Tab) with way more options, such as choosing colors for each scenario (locked units, system units, etc.), or disabling them altogether. -
And yet you asked it.
-
I sort of assumed that 16777619 in that code was a prime, but wanted to check... ChatGPT 4o mini said "No". So, I asked CoPilot in Norwegian - and it said "No" (Nei) On a whim, I then asked it in English LLMs - Lovely Lying Machines.
-
If you were using the RTL dictionary with its abysmal performance, that does not surprise me at all. Mostly because of its poor hash function, replacing that with a better one speeds it up significantly. However, string interning does not require a dictionary with key/value but just a hashtable for strings. DelphiAST has the option to use one for its parsing - we needed that when using it in the context of the IDE to avoid spikes in memory consumption.
-
There are no trivial questions for LLMs...or perhaps I should rephrase that: All questions are considered equally trivial by an LLM. Unless your specific number was covered in a publication it has scanned, it will "know" nothing about that number. Hell, it might even believe it to be your grandmas name, if you should claim so.
-
What problem are you trying to solve?
-
Feature enhancement request - Filter DFM properties
corneliusdavid replied to pyscripter's topic in GExperts
I see Top/Left/Width/Height/ClientWidth/ClientHeight change a lot, too--and I'm pretty sure I don't move those components every time I open a form.- 11 replies
-
Here's my new upgrade process after having so many problems in the past: Disable User Access notifications: I do this temporarily to speed up the process. Uninstall all GetIt Packages: Run AutoGetIt, check "Installed Only" then "Refresh Package List", then select "Uninstall checked" in AutoGetIt; optionally saved checked list. Disable/Remove IDE Plug-ins: Start Delphi and using GExperts Expert Manager, disable all experts, including GExperts itself. Remove Third-party Components: Select Component > Install Packages from the Delphi menu and remove all third-party components. Backup FDConnections: make a copy of the FDConnectionDefs.ini in my "public docs"\Embarcadero\Studio\FireDAC folder. Run the installer, keeping defaults. After the installer is finished, there are similar steps to get my system set up again: Check the Path: If the Path environment variable is getting too long, create short path substitutions and replace their entries. Restore FDConnections: restore the copied FDConnectionDefs.ini. Reinstall Third-Party Components Re-Enable/Reinstall Experts: A lot of times, I find the previously disabled experts to be re-enabled and working but might have to reinstall some. Reinstall GetIt Packages: If AutoGetIt is still running, simply hit "Install Checked" otherwise, load the saved items then install them all. Re-enable User Access Notifications: Do not forget to keep your system protected against unauthorized installs!
-
Yes they are @Tommi Prami. I forget what version the incompatibility was fixed, but the installer still says they aren't compatible, but I've successfully switched during an update.
-
This is the unit @Stefan Glienke was referring to. 100 lines and it uses no other unit!
-
That benchmark proves almost (*) nothing, the only point where it allocates is during the form creation where it builds the card deck and later when it prints the output into the TListBox. (*) the only thing affected here is the possible layout of the card objects in the heap as they are all read during the hand-processing code. The difference that you can observe here between Delphi buids using different memory managers is most likely caused by the amount of overhead the respective memory manager is using thus fitting more card objects within the same memory pages, thus more of them (most likely all on modern processors) fitting into L1 cache. As for this particular code - removing the name of the Cards from the object and only building it when it is needed for some UI would probably speed up code more than anything else because you get rid of 20 Byte for every object (Name is a string[19]) - on my CPU this makes the code go down from ~900ms to ~680ms - simply because it does not need to copy the strings in CopyCardFromDeck. Circumventing the getter and setter of TList (which contribute around 25% of the remaining time) brings it down to 460ms. And after that we are not done with string stuff - in every loop iteration, it calls Hand.SetHighValues which produces a name for the cards on the hand - removing that gets me down to ~400. Now because I have a run and SamplingProfiler open already I see that now one of the scorers is TcaaPokerHand.CopyCardFromDeck - the Items getter is not inlined which causes it to be called 10 times for the same 2 card objects. Changing that gets me down to 270ms. But how about avoiding repeated access to the same object in the 2 lists altogether? 230ms I could go on because I see a lot more room to optimize - but I think I made my point. Instead of fiddling with the memory manager one should first look if heap allocations are even the issue. And then identify unnecessary work and eliminate that. ... change TcaaEvaluationCard to be 8 Byte size - (that avoids that the compiler creates a movsd/movsb instruction but simply does an 8 byte mov) -> 160ms
-
What is your Update Process?
Der schöne Günther replied to Jim McKeeth's topic in Delphi IDE and APIs
I spin up a new VM and start fresh. -
I have since merged the sasl-oauth branch into the master code earlier today.
-
Strings are copy-on-write, but the compiler doesn't do any magic to automatically de-duplicate strings. The only way you get COW efficiency in memory is when you assign one string to another. Some classes have code for deduplication, like TStringList, but you would know if you were using it and it probably doesn't apply to your situation.
-
Seeking Testers for Material 3 Design Demo in Delphi FireMonkey (Athens 12.2)
loki5100 posted a topic in FMX
I’m working on a project using Material 3 Design in Delphi FireMonkey for Athens 12.2. With Skia now integrated in Athens 12.2, we have a similar graphics foundation to Flutter, but we still need a powerful UI component suite to fully unlock Delphi’s design potential. I’ve been using Alcinoe to customize components like Text, Buttons, Switches, TrackBars, etc., into Material 3 Design or even Cupertino style—whatever fits the design. You can easily manage different states like hover, pressed, or disabled directly through the object inspector, which makes it super easy to work with in Athens 12.2. For more info on Alcinoe and Material 3 controls for Delphi, you can check it out here: Material 3 Controls for Delphi – A Modern UI Approach 3. I’ve put together a demo app specifically for Athens 12.2, and I’d really appreciate it if you could test it and give me your feedback. Here’s the link to the demo: https://play.google.com/apps/internaltest/4701314002613599109 To get the app on Google Play, I need around 20 testers. If you’re interested, please send me your Android Gmail address, and I’ll invite you to give it a try. Thanks a lot for your help! -
TParallelArray Sort Performance...
Eric Grange replied to Steve Maughan's topic in RTL and Delphi Object Pascal
I actually used an Introsort implementation you had posted sometime ago, but with the RTL comparare 🙂 However I can't really reproduce your benchmark advantage with latest Spring4D from your repository: in the same conditions as above, Spring4D's sort clocks at 609 ms for 5 million values, just 7% faster than RTL. . The code really goes in the IntroSort_Double methods and the Compare_Double comparer (I checked with the debugger), is there some option or setting required ? When the array is pre-sorted instead of random, the timings are: - RTL TArray.Sort : 265 ms - Spring4D IntroSort : 238 ms - non-generic QuickSort : 78 ms - TParallelArray.Sort: 100 ms So Spring4d gets somewhat faster compared to RTL, but not as a massively as the non-generic Quicksort. The other edge case is an array of 5 millions times the same value: - RTL TArray.Sort : 248 ms - Spring4D IntroSort : 229 ms - non-generic QuickSort : 102 ms - TParallelArray.Sort: CRASH with Stack Overflow !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Ok, this one looks like a death blow to the new parallel sort 😕 For reference, this is the non-generic QuickSort copy-pasta {$R-} {$O+} {$Q-} type TDoubleArray = array [0..MaxInt div 8 - 1] of Double; PDoubleArray = ^TDoubleArray; procedure QuickSort(pArray : PDoubleArray; minIndex, maxIndex : NativeInt); var i, j, p : NativeInt; begin repeat i := minIndex; j := maxIndex; p := (i+j) shr 1; repeat var pv := pArray[p]; while pArray[i] > pv do Inc(i); while pArray[j] < pv do Dec(j); if i <= j then begin var buf := pArray[i]; pArray[i] := pArray[j]; pArray[j] := buf; if p = i then p := j else if p = j then p := i; Inc(i); Dec(j); end; until i > j; if minIndex < j then QuickSort(pArray, minIndex, j); minIndex := i; until i >= maxIndex; end; -
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. -
TParallelArray Sort Performance...
Stefan Glienke replied to Steve Maughan's topic in RTL and Delphi Object Pascal
TParallelArray.Sort is broken by the way - try this: uses System.Threading, System.SysUtils; procedure Main; begin var data: TArray<Integer>; SetLength(data, 1000000); for var i := 0 to High(data) do data[i] := Random(16); TParallelArray.Sort<Integer>(data); end; begin try Main; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; Writeln('done'); Readln; end. -
TParallelArray Sort Performance...
Eric Grange replied to Steve Maughan's topic in RTL and Delphi Object Pascal
@Stefan Glienke I've been testing Introsort and other variants as well, they're more resilient to edge cases, but in the typical case, I've found them to be quite underwhelming tbh in Delphi. In C++ that's different, templates vs generics + loop unrolling give a definitive edge. On a slower processor (i7-1165G7), for 5 millions values: - TArray.Sort: 641 ms - TArray.IntroSort: 673 ms - Quicksort (non generic, single-thread): 450 ms - TParallelArray.Sort: 176 ms So 3.6x speedup over TArray.Sort for a quad-core, which is fair. Overhead of generics is about 40%. On larger array sizes (like 1T), timing ratios are similar, but the whole machine became unusably slow during the TParallelArray.Sort run, so that's something to keep in mind (don't use it to sort large arrays in a GUI app where you need to keep things snappy) -
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. -
Conversion between Markdown and HTML
Carlo Barazzetta replied to John Kouraklis's topic in General Help
Here you can see a full project to convert MarkDown to HTML (but not the inverse process): https://github.com/EtheaDev/MarkdownShellExtensions