-
Content Count
1428 -
Joined
-
Last visited
-
Days Won
141
Everything posted by Stefan Glienke
-
Could a goto out of a try block be supported - yes. It would require properly transferring control to the finally blocks and then transferring control to the target label. This would require significant work in the compiler. Given how popular the use of goto is, that would be a complete waste of resources. See how the C# spec defines the behavior of a goto out of a try block: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/statements#13104-the-goto-statement
-
Spring4D dictionary and record values
Stefan Glienke replied to Tommi Prami's topic in Delphi Third-Party
More features, better performance, fewer bugs (and if there are any not having to wait for the Delphi version that fixes them), less binary code bloat. -
At least in 13 they would have an excuse for poor quality
-
Why does Delphi 12 marginally bloat EXE file size compared to 11.1?
Stefan Glienke replied to PaulM117's topic in RTL and Delphi Object Pascal
Also not true (anymore, it might have been decades ago) - or it might happen that a shifting pointer might be better because of register pressure or shortage under x86 because it only requires one register opposed to two when indexing into an array. But indexing into a memory address with an increasing or decreasing index register is always faster. Another situation might happen when your array is a field of your class and you index into that one because then the compiler is really stupid and re-reads the field every time and then indexes into it. But then the issue is re-reading the field and not the indexing into it. I solved this by putting the array into a local pointer variable and then index into that one - like here. And yet another situation happens on 64bit when using an Integer index variable because then it always does an extra register widening instruction which can be not zero cost (yes, I need to fix the code I just pointed to because it does exactly that having i declared as Integer and not NativeInt as it should be, shoot me). Oh, one particular bad thing about dcc64 is that it does not really optimize some instructions in loops well. From dcc32 we know about the counting down to 0 behavior of a for-to loop where it maintains two counters, the actual index variable (if you actually use that within the loop) and the counting down to 0 variable that it uses to control the loop. For that it usually uses the dec/jnz combination which works well, macro fuses and all that. On win64 it does sub reg, 1, test reg, reg, jnz where only test and jnz fuse which causes wasted cycles. That extra test is complete bonkers because the sub (which should actually be a dec) already sets the zero flag! See RSP-37745 Another missed opportunity of loop optimization that affects both win32 and win64 is letting the compiler create loop that counts from -count to -1 which is another optimization technique where you grab the position after the last element then index into it. This way if you don't need the index variable itself for something else than indexing you only need 2 registers, one points to right after the last element and the loop just needs the nicely fusing inc reg, jnz -
Why does Delphi 12 marginally bloat EXE file size compared to 11.1?
Stefan Glienke replied to PaulM117's topic in RTL and Delphi Object Pascal
This is false knowledge - it only does repeated calls to Length when you do for x in some_dynamic_array do loop -
Why does Delphi 12 marginally bloat EXE file size compared to 11.1?
Stefan Glienke replied to PaulM117's topic in RTL and Delphi Object Pascal
If you care about such things you are totally wrong using Delphi - especially 64bit. It does suboptimal use of all the registers available in 64bit, it produces a crapton of conditional jumps instead of better alternatives that exist for decades, it does not use SSE (let alone AVX) which exists almost as long (except for some floating point stuff), it does zero optimization wrt to loop alignment, it does not restructure binary code so that some cold code does not sit in the middle of some hot code. I could go on, but these are just a few things that matter more if you really care about the least ns squeezed out of your application than some 300K of binary size. -
Why does Delphi 12 marginally bloat EXE file size compared to 11.1?
Stefan Glienke replied to PaulM117's topic in RTL and Delphi Object Pascal
It better be - I spent quite some time on it. FWIW it was already introduced in 11.3 -
Why does Delphi 12 marginally bloat EXE file size compared to 11.1?
Stefan Glienke replied to PaulM117's topic in RTL and Delphi Object Pascal
You realize that it's not "exact same code" if you compare 11 and 12, right? The code in the RTL and the VCL or FMX (depending on which one you use) - change between those versions. It only requires one use of a class somewhere that was not used before or an introduction of an additional list of something inside of some class and the binary size increases. Go diff the source directory of your C:\Program Files (x86)\Embarcadero\Studio\22.0 and C:\Program Files (x86)\Embarcadero\Studio\23.0 directories and check for yourself. Or build with a map file and then diff the map file to find these changes. Also - and this might be marginal but contribute to the overall increase: they changed the count and index of all collection types to NativeInt which means that some instructions regarding those might be a few bytes larger on 64bit (see some x86-64 instruction reference of your choice for details). Otherwise, when I think about it it might also save a few bytes because it does no do register widening anymore on 64bit. So take this last paragraph with a grain of salt and consider it just additional information. I would guess a few fixes and new features here and there can easily add up to 300K more binary size - especially with the general issue the Delphi compiler has with generics - see RSP-16520. -
Marketing people don't fix bugs 😉
-
TBH IMO using years is kinda ok and a version number where the number after the dot means "update to that version". What was marketing bs was the XE numbering and then later making the 10 minor versions actually major versions - combining that with city names just made things more confusing (man, I still have to think if Tokyo or Rio was first...). Funny enough as far as I can see the IDEs in 11 and 12 don't reference the city name anywhere.
-
CreateProcess and IPC
-
LSP has an official protocol though I don't know exactly which version and which subset Embarcadero supports - but it's enough to let you use it in VS Code.
-
Intel Simd-sort library
Stefan Glienke replied to Tommi Prami's topic in Algorithms, Data Structures and Class Design
Indirectly does not matter for this algorithm because it directly sorts a vector of integer or float - and DB keys are organized in a different layout. Again, the question was not in sorting millions of elements of data but strictly sorting arrays of integer or float. -
Intel Simd-sort library
Stefan Glienke replied to Tommi Prami's topic in Algorithms, Data Structures and Class Design
A serious question because many sort benchmarks are so obsessed with sorting large arrays/vectors of just integers and floats: Do people in reality really have these kinds of data that need to be sorted? -
How to sort only a part of a list
Stefan Glienke replied to caymon's topic in Algorithms, Data Structures and Class Design
Using 10.4 you can do this with the following code: TArray.Sort<yourtype>(list.PList^, list.Comparer, index, count); -
I reported that issue years ago but unfortunately it still exists - the report contains the exact steps that lead to this at the end and thus might help to avoid it in the future:
-
sort project files in alphabetical order
Stefan Glienke replied to dan27125's topic in Delphi IDE and APIs
No, but it should be pretty simple to sort the ItemGroup node in the groupproj file according to your needs. -
fwiw all parameters but passing the mapfile name (since the exe name is most likely the same and directly next to it) and the -bind parameter (which causes the PE header in the binary to be updated in order for VTune to properly use the pdb) are optional. VTune has some very extensive documentation and even a tour inside the application that teaches the basics
-
Testers needed for GExperts Instant Grep expert
Stefan Glienke replied to dummzeuch's topic in GExperts
Putting the line number to the left into a gutter just like in the editor would save a lot of vertical space - take a look at the Notepad++ search results window -
Setting the drop down width of a Combobox in Delphi
Stefan Glienke replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
Not so fast - it more likely was some AI that learned it from those sources - soon all loops will be written that way! The problem is that apparently whoever implemented it that way in the VCL did not even care to apply their style guide to the code. And I am not even going into the legal ramifications of Embarcadero copying code from the internet and then putting it under their copyright. -
An interesting read on implementing some data structures
Stefan Glienke replied to Tommi Prami's topic in Algorithms, Data Structures and Class Design
Anyone serious about implementing any data structures that require heap allocation should consider some sort of suballocation pattern to avoid or mitigate memory fragmentation. Also, there is a reason why things like rebuilding indexes exist in databases. -
Question: Is there a way to tell whether a method is overloaded using rtti?
Stefan Glienke replied to pyscripter's topic in RTL and Delphi Object Pascal
No, RTTI does not contain any flag for a method being overloaded which makes it impossible to do proper overload resolution using RTTI because you cannot determine if a method would be "visible" or not. -
When will we have a 64-bit IDE version ?
Stefan Glienke replied to luciano_f's topic in Delphi IDE and APIs
Could it be that you have some active database connection and live data? That contributes to the memory consumption of the bds.exe process. Edit: Also FWIW the memory shown in the TaskManager is the memory consumed for that process and all its sub-processes - click the expand button and you will see. I assume that there will be several LSP Server processes consuming quite some memory. -
Might it be worth considering restructuring the Main menu which is getting longer and longer and organize the items in sub items to clean it up?
-
A multiline string is multiline - simple as that.