-
Content Count
1428 -
Joined
-
Last visited
-
Days Won
141
Everything posted by Stefan Glienke
-
struggling while importing c-function with multiple dereferenced pointers
Stefan Glienke replied to Daniel's topic in RTL and Delphi Object Pascal
Should be an (*1)array of (*2)pointer to libvlc_media_track_t passed by (*3)reference, no? -
Generic set comparer
Stefan Glienke replied to Attila Kovacs's topic in Algorithms, Data Structures and Class Design
Spring4D has ISet<T> and 2.0 will introduce IMultiSet<T> -
Quickly zero all local variables?
Stefan Glienke replied to A.M. Hoornweg's topic in RTL and Delphi Object Pascal
Isn't it usually Sheldon who comes up with ridiculous stuff just to win an argument? -
Quickly zero all local variables?
Stefan Glienke replied to A.M. Hoornweg's topic in RTL and Delphi Object Pascal
@Lajos Juhász Already reported as RSP-24383 @A.M. Hoornweg Might be RSP-19835 that got you. -
atomic setting of a double variable
Stefan Glienke replied to dummzeuch's topic in Algorithms, Data Structures and Class Design
I think the reason why people keep coming back is that there is uncertainty about when it can be assumed that the data is aligned properly. A local or global variable for example is not guaranteed to be naturally aligned. -
Delphi Native Code: Fast or Reliable?
Stefan Glienke replied to Mike Torrettinni's topic in Tips / Blogs / Tutorials / Videos
100% this - any other program built with a programming language that directly is built ontop of winapi works as well - you only need to change applications in order to use and embrace new features or recommendations (such as not storing configuration or user specific data next to the binaries in programfiles) -
TimSort for Delphi without Generics
Stefan Glienke replied to dummzeuch's topic in Algorithms, Data Structures and Class Design
Just tested with some integers (where sorting stability does not matter anyway): - for random data non generic code is slightly faster simply because they can use the comparison operators instead of doing rather costly comparer calls (even if the comparer itself is the default one) - approx 2 times - already sorted almost identical speed - reversed sorted data timsort is like 8 times faster -
atomic setting of a double variable
Stefan Glienke replied to dummzeuch's topic in Algorithms, Data Structures and Class Design
If you actually clicked on the link I provided and followed the other links provided in that answer by Peter Cordes (who is like the Jon Skeet on asm related stuff on SO) you will ultimately find a quote from the Intel documentation (and the AMD one agreeing on that) which states: Which is why I wrote that it works when target is aligned naturally which means by 64 bit - that in itself ensures that it does not cross a cache line. Now arguing that the presented solution does not work when this is not given is kinda moot. Thomas stated that he wants to "set a double variable in a thread safe manner" - which I assume is meant literally and a double variable will be 64-bit aligned. -
atomic setting of a double variable
Stefan Glienke replied to dummzeuch's topic in Algorithms, Data Structures and Class Design
movq xmm0,[value] movq [target],xmm0 should do the trick when target is naturally aligned - for reference. -
Delphi 64bit compiler RTL speedup
Stefan Glienke replied to RDP1974's topic in RTL and Delphi Object Pascal
The lack of pdb support in Delphi makes it tedious to use because you only get addresses reported which you then have to manually look up. -
Delphi 64bit compiler RTL speedup
Stefan Glienke replied to RDP1974's topic in RTL and Delphi Object Pascal
Just pointing this out so you don't get yourself into trouble: IANAL but the fact that the IPP is under a commercial license or a free license if you qualify (time limited if I read it correctly - but I just quickly skimmed through it) might make it arguable to actually distribute any parts of it. If you know more about it I would be glad to be wrong. And as said before - even though your intentions are surely to make it easy for users - putting the source for those projects with an explanation how to build them would get you on the safe side. -
Delphi 64bit compiler RTL speedup
Stefan Glienke replied to RDP1974's topic in RTL and Delphi Object Pascal
Why isn't the code of those dlls open source as well? If they are simply directly taken from those Intel libraries, provide a link how to get them directly from the original source. -
I would like to add: "because good compilers can turn such code into the most efficient code."
-
Addendum to Martin Fowler quote
Stefan Glienke replied to Stefan Glienke's topic in Tips / Blogs / Tutorials / Videos
Notice that I wrote "efficient code" - it's not only about applications running fast (enough) but also energy efficient which most people tend to forget. -
When sorting a “StringList” is very costly
Stefan Glienke replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
Then you are almost at an Introsort (Spring4D uses that instead of plain Quicksort) -
Is it really that bad to Use boolean parameters to make your functions do two things?
Stefan Glienke replied to Mike Torrettinni's topic in General Help
Always understand the reason behind guidelines, suggestions, principles: why is it a good thing to do x - not just because famous person y said so. Because when you understand why something is a good or bad thing to do you are able to evaluate the situations where you want or dont want to follow them and what implications arise. -
The Case of Delphi Const String Parameters
Stefan Glienke replied to Mike Torrettinni's topic in RTL and Delphi Object Pascal
The question stands - there is no "yes/no" about that - their reference count is threadsafe - an assignment is not because its not atomic (which is the very same issue that Dalija wrote about in her blog post). About this discussion I think it is nonsense - the issue being pointed out by Marco arises when you access something with a broader scope than where you are currently - i.e. a global variable or a variable outside of the current nested routine - that also includes passing the same variable by reference twice or more and modifying it. f(i,i) would also be defect if it was implemented like this: while a > 0 do begin Inc(b); Dec(a); end; "Better" for strings would raise the question: better for what? Memory consumption? UTF8, string interning. Multithreading? Immutability. Memory locality? Short string optimization (i.e. avoiding the memory indirection) - there are probably more and most of them would be a complete breaking change even more than Delphi 2009. -
The Case of Delphi Const String Parameters
Stefan Glienke replied to Mike Torrettinni's topic in RTL and Delphi Object Pascal
What is thread safety anyway? -
git and Delphi tooling?
Stefan Glienke replied to Lars Fosdal's topic in Project Planning and -Management
I uninstalled SourceTree (which I had been using for years before with decreasing joy) the day I started using Fork and never looked back - back then Fork was completely free and changed to a paid license later but those 50 bucks were very well spent. -
DPM Package Manager - presentation
Stefan Glienke replied to Vincent Parrett's topic in Delphi Third-Party
I kinda like DPM - TLAs FTW -
Manage overloaded IfThen functions
Stefan Glienke replied to Mike Torrettinni's topic in General Help
That or something like this. -
Is someone using MVVM?
Stefan Glienke replied to Javier Tarí's topic in Algorithms, Data Structures and Class Design
Best since sliced bread ... if you're not in Delphi -
Micro optimization - effect of defined and not used local variables
Stefan Glienke replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
What if we could write optimized code right from the start and would not have to deal with all that shit because the compiler has the intelligence of a rock. What if good coding practices could be tought by the editor via suggesting things (look at quick actions in Visual Studio that will help you with many different things - from fixing formatting to suggesting some refactoring) Much backwards compatibility is eyewash and simply means: "we did not change the signature but sacrificed some firstborn to make it still work". If you provide - there is it again - tooling to detect and guide you with moving forward (yes, often backwards compatibility is nice because I don't have to ifdef my code for a dozen different versions) then breaking changes are not bad. -
Micro optimization - effect of defined and not used local variables
Stefan Glienke replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
I disagree - this is exactly the mindset that we got trained all these years because we did not know any better - the world moved on - heck there are people working on programming tools based on ML so it can suggest refactorings based on refactorings you have done in the past! And yet here we are mostly doing yolo driven development - "if it aint break it might be ok" (ok, I am exaggerating here). If the tooling can point out possible optimizations because they understand what you are doing that can just be good regardless of how much of a measurable improvement that will make. And if its just for some junior coders at Embarcadero slapping together some ... ahem ... non ideal code that never gets properly reviewed because lack of time. It took them years and an actual change of the FreeAndNil function to find bugs in their code that static code analysis could have found ages ago. -
Manage overloaded IfThen functions
Stefan Glienke replied to Mike Torrettinni's topic in General Help
https://en.wikipedia.org/wiki/Principle_of_least_astonishment And now imagine some compiler that turns that into proper code with as little conditional jumps as possible: https://godbolt.org/z/KqhKnx