Mike Torrettinni
Members-
Content Count
1509 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Mike Torrettinni
-
Fast lookup tables - TArray.BinarySearch vs Dictionary vs binary search
Mike Torrettinni replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Thanks, very good results! -
Fast lookup tables - TArray.BinarySearch vs Dictionary vs binary search
Mike Torrettinni replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Oh, didn't know about this. But results are pretty much the same for me, even thought I put all the calls and vars in procedure. Did you make any other changes? Because your TDict results are very good, but I still get same results. Oh, perhaps is Delphi version, I use 10.2.3. -
Fast lookup tables - TArray.BinarySearch vs Dictionary vs binary search
Mike Torrettinni replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Here is benchmark code, but have in mind it might be a bit complicated because it is a start of my testing a common table lookup implementation (see posts above): https://pastebin.com/itBRv76X TSynDictionary (SynCommons.pas): https://github.com/synopse/mORMot -
Fast lookup tables - TArray.BinarySearch vs Dictionary vs binary search
Mike Torrettinni replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
I finally realized why binary search by ID (integer) was slower than by Name (string): because function by ID was returning a Name (string). If I return data index or pointer, the speed is same. Everyday learning something new. -
How to compare performance between Delphi versions?
Mike Torrettinni replied to Mike Torrettinni's topic in General Help
Aha, now I get it! And since we can't mix 32 and 64, I should create both versions. Thanks! -
How to compare performance between Delphi versions?
Mike Torrettinni replied to Mike Torrettinni's topic in General Help
Can you please expand on this? I have only basic experience with dlls. -
How to compare performance between Delphi versions?
Mike Torrettinni replied to Mike Torrettinni's topic in General Help
Thanks, was just thinking about this. But why do you suggest dll, just exe would work, right? -
How to compare performance between Delphi versions?
Mike Torrettinni replied to Mike Torrettinni's topic in General Help
This is interesting, since I'm still on 10.2 so the difference could be even bigger. Any example showing a difference in performance would be great! -
How to compare performance between Delphi versions?
Mike Torrettinni replied to Mike Torrettinni's topic in General Help
At the time, this was too complicated for me to handle. -
How to compare performance between Delphi versions?
Mike Torrettinni replied to Mike Torrettinni's topic in General Help
Yes, but if you need 2 different dll versions for different project, you need register and un-register each time you use different project. -
How to compare performance between Delphi versions?
Mike Torrettinni replied to Mike Torrettinni's topic in General Help
Skipping 10.3 and 10.4 due to some code wasn't ready for migration at the time. When I saw bug fix list for 10.4.2 I was planning to upgrade, but then I decided to wait for next major release. -
How to compare performance between Delphi versions?
Mike Torrettinni replied to Mike Torrettinni's topic in General Help
@emailx45 Not sure if you saw all the topics with 10.4.2 issues in last 2 weeks on this forum, just use search. I will skip it. @David Hoyle I remember Eurekalog was one of the issues, I think because I couldn't customize installation folders. Also activex dll which needs to be registered - I needed to register different dll version each time I switched projects. Annoying, but like I said, I probably didn't spend enough time resolving these issues. The 3rd party source that doesn't need to be installed was OK, like you said in different folders. -
How to compare performance between Delphi versions?
Mike Torrettinni replied to Mike Torrettinni's topic in General Help
I had some issues with 3rd party code, when I had 2 versions installed. I remember registered activex control was causing some issues, too. Perhaps I need to spend more time solving these issue when 10.5 is out. It would be nice to have 2 versions installed side by side, for a couple of days at least, to check performance. -
Micro optimization: use Pos before StringReplace
Mike Torrettinni replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
To avoid Delphi's string protection that can be slow when performance is needed, but string change is rarely actually changed. See more here: https://www.delphitools.info/2009/05/06/code-optimization-go-for-the-jugular/ What Delphi version are you talking about, what faster function? -
Fast lookup tables - TArray.BinarySearch vs Dictionary vs binary search
Mike Torrettinni replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
I re-ran with TSynDictionary to verify again, and it's much faster versus TDictionary for string searches, not so much for integers. But seems to be pretty much same performance in 32bit and 64 bit! 32bit: 64bit: -
Fast lookup tables - TArray.BinarySearch vs Dictionary vs binary search
Mike Torrettinni replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Thanks for the tip! In next few weeks I will start benchmarking 64bit in my project and see how it goes. But just this simple test showed I have these little slow pieces all over the project, so not neccessarily a stand-out bottleneck, but definitely a refactoring and faster implementation is needed in a lot of places. Will see how 64bit behaves. -
Fast lookup tables - TArray.BinarySearch vs Dictionary vs binary search
Mike Torrettinni replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Thanks, but since max records is 10K and rare, I think I can skip this for now, but perhaps in the future. -
Fast lookup tables - TArray.BinarySearch vs Dictionary vs binary search
Mike Torrettinni replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Is this same, similar as Trie (https://en.wikipedia.org/wiki/Trie)? Something might come useful down the line, but right now probably overkill. -
Fast lookup tables - TArray.BinarySearch vs Dictionary vs binary search
Mike Torrettinni replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Hm, you are right, some are 1-n in range, some are random. Perhaps I can have a flag that will determine if access is direct or by search mechanism (TDictionary or bin array). Well, 2.5x slower (5x was exaggeration) , when run as 64bit, while the rest is still acceptable: -
Fast lookup tables - TArray.BinarySearch vs Dictionary vs binary search
Mike Torrettinni replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
My data is simple in 99% cases: ID = integer, full range 1.. MaxInt (but I guess that doesn't matter), string= 12-30 characters. In majority cases it's populated at start, sorted once and then just used for accessing by ID, Name, single random lookup - I mean no lookups in sequence. I guess. Currently looking for general fast implementation. The biggest data tables, 1K-10K records are not accessed often, but I still want to implement faster access - because sequential access by string gets crazy slower in 64bit - 5x! That's why I'm looking for ready made solution. I tried to implement search by integer, a copy of TGpStrinhHash, and it got so complicated I made a mess. Like you said, I don't want to use something that can have bugs, for a few percentage. Not in this case. -
Idera acquires PreEmptive
Mike Torrettinni replied to Darian Miller's topic in Tips / Blogs / Tutorials / Videos
Thanks @Kas Ob. , the whole enterprise 'call us for pricing' had me thinking if it could be something more than the simple things that have been around for ages, the obfuscation and others like you say. -
Idera acquires PreEmptive
Mike Torrettinni replied to Darian Miller's topic in Tips / Blogs / Tutorials / Videos
Are you familiar with PreEmptive solutions? Perhaps they will offer similar protective solutions for Delphi. Even though I can't imagine how it works and I never needed anything as such, but perhaps something new and useful can be made. -
Several F2084 Internal Error on Delphi 10.4.2
Mike Torrettinni replied to Davide Angeli's topic in Delphi IDE and APIs
I just had similar issue compiling for 64bit Windows and it was due to inline keyword after function declaration, which compiled OK for 32bit. So, if you have small example you can maybe find the cause, but with large code base it good take you good time to chase down the cause, if you ever find it. -
I will be less active for a few weeks
Mike Torrettinni replied to Lars Fosdal's topic in Community Management
@Lars Fosdal Not sure which phone and android version you have, but voice to text has come along way and is pretty good. No reason to be absent 😉 I hope your arm heals fast! -
How do you identify bottleneck in Delphi code?
Mike Torrettinni posted a topic in Tips / Blogs / Tutorials / Videos
I'm interested how you guys identify bottlenecks in your source code. When I profile my code, I usually try to optimize anything that could reduce execution time by least 10%+. It also depends what I see that can be optimized or is very clearly badly designed. Sometimes I think I can improve it and it ends up even worse 😉 When do you decide you will try to optimize certain parts of the code? How you define bottlenecks, is it the expected percentage of improvement (5,10, 50%...)? Do you ever optimize something that is not a bottleneck, but a customer/user is requesting performance improvements?