-
Content Count
1428 -
Joined
-
Last visited
-
Days Won
141
Everything posted by Stefan Glienke
-
Those Delphi Linux numbers are sad to see - but no surprise given how bad LLVM is being used (it basically lacks the IL opt step). Would be interested to see the difference between what dcc64 and fpc emit though - can do share the benchmark code somewhere?
-
According to several sources, there are around 28 million software developers worldwide, give or take. I am highly skeptical that every 10th of them is a Delphi user. The number I have seen for C# is around 6 million. The 2022 Stackoverflow survey had around 3.5% of the participants list Delphi for the question "Which programming, scripting, and markup languages have you done extensive development work in over the past year, and which do you want to work in over the next year?" - C# has 28-30% mentioned in that list. If we check the 28mio software developers vs the 6 million C# users from some statistics with this percentage we see that this is somewhat realistic (30% of 28mio would be 8.4mio and 6mio out 28mio is around 21%). So we can assume that although Stackoverflow survey participants are not representative of the entire developer population we get kinda realistic numbers. If we assume that Delphi users were not overly invested in participating in the survey that leads us to around roughly 1mio.
-
Simply use the contains filter instead of like - for reference: https://supportcenter.devexpress.com/ticket/details/t803106/changing-default-filter-condition-from-equal-to-contains
-
LinkedList pointer implementation gives bad results!
Stefan Glienke replied to Giorgi Chapidze's topic in Algorithms, Data Structures and Class Design
No, not always - that's why it says "Measure, don't guess". Anyway apart from being Java, that article is over 10 years old and things change - libraries get optimized (yes, even Java ) I have no idea how the various pieces at play are implemented in Java - so why don't you simply run your own benchmark? I explicitly did not mention search but wrote insert or delete. I am well aware of the fact that access to contiguous memory is so much faster than random memory access that I know that if you add searching to the use case the more costly insert/delete can become totally irrelevant simply because the search is so much faster. Of course, usually, you don't just insert or delete to a linked list but also perform some search to determine the location where to insert or delete which is the reason why many benchmarks also include search. I know a lot of literature mentions using linked list + hashtable but I would probably simply use a queue or deque that is backed by a circular array buffer. If there is anything to take away from the article you linked to then it is this: This is because it completely ignores constant factors. Constant factors are why often the fastest algorithms and data structures, in reality, are hybrids that combine different algorithms. IntroSort is a good example that combines QuickSort with InsertionSort (for small sizes) and switches to HeapSort for QuickSorts worse cases. If you would ask "Which is better: QuickSort or InsertionSort?" Many people would say "QuickSort" but the the fact is that it depends on the number of elements. Similar to the question "Which is faster: a hashtable or linear search in an array?" Again it depends on several factors: the number of elements, the expense of comparison and hashing, and the actual implementation of the hashtable. And talking about the O(n) for inserting or deleting from a list. Here is a little benchmark and the results from Delphi 10.4 and 11.3: program BenchListInsertDelete; {$APPTYPE CONSOLE} uses Spring.Benchmark, System.Generics.Collections; procedure InsertDelete(const state: TState); var list: TList<Integer>; i: Integer; _: TState.TValue; begin list := TList<Integer>.Create; list.Capacity := 1000; for _ in state do begin for i := 1 to 1000 do list.Insert(0, i); for i := 1 to 1000 do list.Delete(0); end; end; begin Benchmark(InsertDelete, 'insert-delete').MinTime(2); Benchmark_Main(); Readln; end. Delphi 10.4.2 ---------------------------------------------------------------------- Benchmark Time CPU Iterations ---------------------------------------------------------------------- insert-delete/minTime:2,000 223341 ns 223644 ns 11947 Delphi 11.3 ---------------------------------------------------------------------- Benchmark Time CPU Iterations ---------------------------------------------------------------------- insert-delete/minTime:2,000 41379 ns 41487 ns 68923 You can guess why that is- 19 replies
-
- data structures
- pointers
-
(and 1 more)
Tagged with:
-
LinkedList pointer implementation gives bad results!
Stefan Glienke replied to Giorgi Chapidze's topic in Algorithms, Data Structures and Class Design
I think this came as response to some general pointer-related comment and is quite OT to the original topic which was about linked list - but I agree - especially when dealing with string parsing and alike, naive code often is full of tiny substring allocations which could be avoided by similar approaches as .NET went with their Span<T> - using that throughout the runtime significantly improved performance in many areas. In Delphi code one typically uses PChar but that lacks a length limitation and routines that take that into account often have an additional len parameter which requires carrying around two distinct values which in fact belong together.- 19 replies
-
- data structures
- pointers
-
(and 1 more)
Tagged with:
-
LinkedList pointer implementation gives bad results!
Stefan Glienke replied to Giorgi Chapidze's topic in Algorithms, Data Structures and Class Design
It is and that is not the main purpose of using a linked list - a linked list shines when you often insert or delete entries because that is O(1) whereas using an array is O(n) because of the necessary move operation.- 19 replies
-
- data structures
- pointers
-
(and 1 more)
Tagged with:
-
That would be quite nonsense given that strs is TStrings as David wrote ("strs points to a memo.Lines property"). Then don't use a Memo and its Lines property I would say - they are Unicode.
-
TO ChatGPT: In Delphi, is there any kind of an adapter or class that takes a TList<T> and makes it look like a TDataSet?
Stefan Glienke replied to David Schwartz's topic in Databases
I have no experience with ChatGPT writing unit tests but there have been some other approaches explicitly for unit tests that are based on static code analysis because then it knows exactly what code to write to exercise all possible paths. For Delphi land that however is utopia since all the tools in these areas typically don't know anything about delphi/pascal. -
Looks to be yet another Bitbucket glitch - I have seen others report the same behavior recently and in the past. One more reason to move forward to another place rather sooner than later (99% sure it will be github which only lost to bitbucket back then because it did not have free private repos at that time).
-
The days of using Bitbucket are coming to an end later this year anyway.
-
These are the issue tracker settings that have not been changed for ages: And given that the most recent reported issue was reported on march 11 I assume that it's possible.
-
Any registered Bitbucket user can report an issue here.
-
TO ChatGPT: In Delphi, is there any kind of an adapter or class that takes a TList<T> and makes it look like a TDataSet?
Stefan Glienke replied to David Schwartz's topic in Databases
Especially when your own code doesn't work and you don't even know why, amirite? 😉 -
spring4d Spring4d compile error on Delphi CE 10.4.2
Stefan Glienke replied to Giorgi Chapidze's topic in General Help
I do, in fact, last week I did the 2.0 rc1 -
spring4d Spring4d compile error on Delphi CE 10.4.2
Stefan Glienke replied to Giorgi Chapidze's topic in General Help
CE does not have working command line compilers afaik so you have to manually install: - open <your-spring4d-dir>\Packages\Delphi10Sydney\Spring4D.groupproj - build the project group (unit tests might not compile as they require TestInsight - does not matter to you) - add <your-spring4d-dir>\Library\Delphi10Sydney\<platform>\<config> directory to the library path (Tools->Options... then Language->Delphi->Library (select the platform at the top and then "..." next to the Library path -
It does not - check again your code - it says: o := Use<TObjectClass>.When(Cond, TObject, TStringList); but clearly, you meant: o := Use.When<TObjectClass>(Cond, TObject, TStringList); No, it does not (in 11.3). And even in older versions, assigning any literal to Byte that is not within 0..255 always gives an E1012
-
Apart from the last line which does not compile because Use is not generic. You are thinking wrong - Delphi never infers from the lhs but only from the passed parameter. And there is usually takes the type from the first one if you have multiple with the same generic type - that is why it needs help with the 1, -2 combination.
-
I love it when people that don't do open source (or at least not that I know - please correct me if I am wrong) try to force people to make their code free and open source.
-
I doubt that because sgcWebSockets is not published under a license that allows this.
-
You might not like it but it's according to the Licenses. Open source does not mean that any modification automatically has to be open and free - that would be the case if choosing MPL.
-
TO ChatGPT: In Delphi, is there any kind of an adapter or class that takes a TList<T> and makes it look like a TDataSet?
Stefan Glienke replied to David Schwartz's topic in Databases
Maybe because they did not want to look for the problem description within an entire novel? https://en.wikipedia.org/wiki/XY_problem - addressing that is better than giving a solution to what has been asked. Granted the structure and the goal of SO are not well suited for that at times. ChatGPT is like a device that gives you fish whenever you need some but it won't teach you to fish. This leads to the dilemma I wrote about before: maybe it will be the future where all we know is how to ask good questions to our AI that solves the issues for us that we are not able to solve ourselves anymore. -
TO ChatGPT: In Delphi, is there any kind of an adapter or class that takes a TList<T> and makes it look like a TDataSet?
Stefan Glienke replied to David Schwartz's topic in Databases
I think we are down to the real issue here: one's own personality. I rather filter out some ego-stroking to get good peer-reviewed advice than some untested garbage but I know people that are already offended when you say: "Sorry, but there is a slight possibility of you being not 100% correct here" (actually meaning: you could not be more wrong). People with a personality like that are usually the ones complaining about SO. I am worried that their solution is using AI-provided help that is completely unchecked and will turn into the software that runs the world in the future. -
Just an excerpt from the mormot2 tests (win32, win64 numbers look similar) running on an i7-12700 10.4.2 - Custom RTL: 297,648 assertions passed 285.77ms FillChar in 9.37ms, 41.4 GB/s Move in 22.25ms, 14 GB/s small Move in 25.05ms, 4.3 GB/s big Move in 25.06ms, 15.5 GB/s FillCharFast in 8.21ms, 47.3 GB/s MoveFast in 42.99ms, 7.2 GB/s small MoveFast in 17.15ms, 6.3 GB/s big MoveFast in 26.59ms, 14.6 GB/s 11.3 - Custom RTL: 297,648 assertions passed 247.86ms FillChar in 6.37ms, 60.9 GB/s Move in 10.10ms, 30.9 GB/s small Move in 17.98ms, 6 GB/s big Move in 14.77ms, 26.4 GB/s FillCharFast in 7.37ms, 52.6 GB/s MoveFast in 42.76ms, 7.3 GB/s small MoveFast in 16.83ms, 6.5 GB/s big MoveFast in 27.69ms, 14.1 GB/s The first 4 are RTL functions, last 4 are mormot implementations. Take this with a grain of salt though as these are just unit tests and not a performance benchmark but it gives a little idea. FillChar has already been improved by me for 11.1 and Move will be in 11.3 (along with other improvements in the core RTL) No, this is not suddenly making your applications twice as fast but solves the old complaints of FillChar and Move being sooo slow. 😉
-
Some sneak peek of some performance numbers with 11.3
Stefan Glienke replied to Stefan Glienke's topic in I made this
Everything but windows uses libc memmove - we can assume they do their job and have optimized it - similar to FillChar which then uses memset. Until Embarcadero gets their sh*t together with their llvm compilers not generating kinda -O0 quality code personally I don't care about Linux performance anyway. -
TO ChatGPT: In Delphi, is there any kind of an adapter or class that takes a TList<T> and makes it look like a TDataSet?
Stefan Glienke replied to David Schwartz's topic in Databases
DDuce does not have a TListDataSet (anymore?) it uses TObjectDataSet from Spring4d