-
Content Count
1518 -
Joined
-
Last visited
-
Days Won
154
Everything posted by Stefan Glienke
-
A smart case statement in Delphi?
Stefan Glienke replied to PeterPanettone's topic in RTL and Delphi Object Pascal
Yeah, sure... -
suggestion for 2 new su forum: AI usage and AI coding
Stefan Glienke replied to Javier Tarí's topic in Community Management
It is as relevant, if not more (there are other results further down the article from other sources) than one person telling me how well AI worked for them. This entire "I need a dedicated sub forum for AI to discuss AI" debate is getting ridiculous - if you have something to share, then do so. If we find out that one or multiple sub forums are containing loads of threads about a certain topic, a mod might create a new sub and move them there - easy as that. -
suggestion for 2 new su forum: AI usage and AI coding
Stefan Glienke replied to Javier Tarí's topic in Community Management
https://fortune.com/2025/07/20/ai-hampers-productivity-software-developers-productivity-study/ -
New Delphi features in Delphi 13
Stefan Glienke replied to David Heffernan's topic in RTL and Delphi Object Pascal
I haven't found a critical regression in the past 24 hours. -
suggestion for 2 new su forum: AI usage and AI coding
Stefan Glienke replied to Javier Tarí's topic in Community Management
Wasting terajoules for basic refactorings, welcome to 2025 -
suggestion for 2 new su forum: AI usage and AI coding
Stefan Glienke replied to Javier Tarí's topic in Community Management
In my opinion, creating new forums should only be considered if there is sufficient activity around this topic (regardless of whether it's AI or anything else), which I don't currently see. -
Global in RTL for unit communication?
Stefan Glienke replied to david berneda's topic in RTL and Delphi Object Pascal
I would assume that both products are from you, though? Then why not make both use a shared package that contains that shared global state? -
This is exactly what I explained back in 2024 in this very thread
-
As much as I did, I assume
-
New YAML Parser Library - VSoft.YAML
Stefan Glienke replied to Vincent Parrett's topic in I made this
You are missing passing TFormatSettings to the StrTo... functions that you are calling - that makes it fail on systems that use a comma as a decimal separator, for example. -
Better TStringList in Spring4D or elsewhere
Stefan Glienke replied to Dave Novo's topic in Delphi Third-Party
Fair enough - however, either only TStringList would have these methods, or they would need to be virtual in TStrings with an unoptimized loop implementation in any inheriting class that desires. FWIW, one of the AddStrings overloads is virtual, but TStringList still does a loop calling InsertItem. Why does it do that? Because InsertItem is also virtual, and any inheriting class can do whatever it wants in there. Providing any non-looping operations would possibly circumvent any custom logic that sits in such an override. -
A smart case statement in Delphi?
Stefan Glienke replied to PeterPanettone's topic in RTL and Delphi Object Pascal
Yes, it solves your problem - but in the context of this thread, this is just a terrible hack - if you add a new case, you have to change not just one place but several ones and make sure you did not make any mistake with the index or the order. -
Better TStringList in Spring4D or elsewhere
Stefan Glienke replied to Dave Novo's topic in Delphi Third-Party
InsertRange and DeleteRange, as you describe them, are not possible without changing the existing TStringList behavior regarding OnChanging/OnChange - currently, if you insert or remove several items in a loop using Insert or Delete, on every OnChanging/OnChange call, the TStringList has the exact Count and Items before/after that one insertion/deletion. With a bulk insert or deletion, that would not be the case. Also, fwiw, the adapter in Spring is to wrap an existing TStrings as an IList<string> if some API requires - not to make TStringList any more performant. Regardless of all the nifty features of TStringList for most string-only operations that need to be super performant, I would rather avoid using it because its internal storage layout is terribly wasteful (i.e., storing those string/object pairs). Also, that adapter is for TStrings and not just for TStringList. -
A smart case statement in Delphi?
Stefan Glienke replied to PeterPanettone's topic in RTL and Delphi Object Pascal
With a fixed set of strings to look up, hashing is never the fastest way, but a handcrafted way. Let's, for example, imagine a case statement that checks for all keywords in the Pascal language. Arrange the strings in the lookup table by length and first letter. You can see how the C# compiler does it - I wrote a simple demo with just a few keywords: https://sharplab.io/#gist:731036823c89363962d7e79f9dc9ed28 There is a lot of material you can read on that subject: it is called "switch lowering" -
The call stacks are bogus - some entries below WideFormatBuf is incorrect - System.LocaleCharsFromUnicode never calls System.SysUtils.WideFormatBuf - but FormatBuf does. Then some entries below DateTimeToString are incorrect - it most likely was called from TryEncodeTime
-
Debugging Reliably with IShared - Spring4D
Stefan Glienke replied to Dave Novo's topic in Delphi Third-Party
It's a known issue that the debugger does not properly pick up inline variables in all cases - nothing IShared specific. -
Debugging Reliably with IShared - Spring4D
Stefan Glienke replied to Dave Novo's topic in Delphi Third-Party
This seems to have nothing to do with IShared, but somehow the debugger is stumbling over something - interestingly enough, it does not even work with the simplest classes. It rather seems that Vcl.Graphics.TBitmap is special somehow, as that is the one I see it working on uses System.SysUtils, Vcl.Graphics; type TFoo = class Width, Height: Integer; end; TBitmap = class // comment out this class and sharedMap will work Width, Height: Integer; end; procedure Test; begin var map := TBitmap.Create; var sharedMap := function: TBitmap begin Result := map end; sharedMap.Width := 100; sharedMap.Height := 100; var foo := TFoo.Create; var sharedFoo := function: TFoo begin Result := foo end; sharedFoo.Width := 100; sharedFoo.Height := 100; end; begin Test; end. Edit: @Uwe Raabe found out that it seems to be related to the property having a getter that is a function - when that is the case, it shows the value - otherwise, a field or property with direct field read access does not. I would call that a bug in the debugger -
Are TInterlocked.Exchange and CompareExchange implementation really Atomic with class types??
Stefan Glienke replied to @AT's topic in RTL and Delphi Object Pascal
FWIW I reported the bad inlining due to the way these methods are implemented in TInterlocked and proposed the improvements in https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-3862 -
Memory Leak reported by FastMM5 with no list to source code
Stefan Glienke replied to Robert Gilland's topic in RTL and Delphi Object Pascal
Looking at the string contents should give a pointer as to where they come from. For example, the one you showed is a 5-character-long string "COSSM" -
CaretPositionRTTIProp.GetValue(Memo1) raises AV
Stefan Glienke replied to dmitrybv's topic in RTL and Delphi Object Pascal
Okay, the reason is because the CaretPosition getter is declared as cdecl (I have no clue why that is the case - I would assume some C++ compat because the result is a record) and the code for getting properties does not know about the calling conventions of their setter and getter (because that is not part of their RTTI but only the code pointer to them) and thus always assumes standard calling convention. -
Absolute directive with record and array
Stefan Glienke replied to DelphiUdIT's topic in Algorithms, Data Structures and Class Design
One could make it a const array of records where mass would be a number instead of a string -
FWIW, such benchmarks should also run in parallel because especially string-related parsing is usually full of heap allocations that can suffer highly in multithreading. I am also sure that @Arnaud Bouchez could join the game and stomp all these libraries into the ground performancewise with mormot
-
What are the performance profilers for Delphi 12?
Stefan Glienke replied to dmitrybv's topic in General Help
I have not tested it with extensive data, but my first impression was that it is way more snappy. It does not have all the extensive capabilities of VTune, but if it does the important stuff way faster than VTune it's a pro IMHO. I also presume that it works fine with AMD CPUs. -
What are the performance profilers for Delphi 12?
Stefan Glienke replied to dmitrybv's topic in General Help
This morning, I started the 14-day trial of Superluminal, and my first impression is very positive. I have yet to run it against more than some tiny toy projects though