Leaderboard
Popular Content
Showing content with the highest reputation on 03/17/21 in Posts
-
Fast lookup tables - TArray.BinarySearch vs Dictionary vs binary search
Stefan Glienke replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
As always you again seem to only read half of what I wrote. Base line (code as you posted) - running on an i5-3570K @ 3.4GHz Get Name from ID (Search by integer): records Sequenced TArray.BinS TDict CustomBinS TSynDict Spring 10 46 397 60 23 48 59 50 72 474 67 28 52 59 100 105 504 62 32 51 59 Get ID from Name (Search by string): records Sequenced TArray.BinS TDict CustomBinS TSynDict Spring 10 21 373 106 11 25 107 50 105 443 109 18 26 110 100 204 487 104 23 29 103 Use equalitycomparer from Tiny.Generics.pas for TDict and Spring - running on the i5-3570K @ 3.4GHz Get Name from ID (Search by integer): records Sequenced TArray.BinS TDict CustomBinS TSynDict Spring 10 45 407 44 24 49 44 50 71 468 42 27 48 42 100 96 499 43 32 53 43 Get ID from Name (Search by string): records Sequenced TArray.BinS TDict CustomBinS TSynDict Spring 10 21 379 26 11 27 25 50 106 445 25 18 27 25 100 207 483 26 22 29 27 Simply put "procedure Main;" after the CreateRandomData procedure and "end;begin Main;" before the end. - running on the i5-3570K @ 3.4GHz Get Name from ID (Search by integer): records Sequenced TArray.BinS TDict CustomBinS TSynDict Spring 10 28 387 27 25 32 26 50 51 455 25 28 32 24 100 76 487 27 32 34 27 Get ID from Name (Search by string): records Sequenced TArray.BinS TDict CustomBinS TSynDict Spring 10 22 380 27 12 25 27 50 105 446 24 18 28 24 100 207 489 25 24 30 26 Same code as before but running on an i7-8700 @ 3.2Ghz Get Name from ID (Search by integer): records Sequenced TArray.BinS TDict CustomBinS TSynDict Spring 10 23 306 21 20 27 20 50 42 355 22 24 28 20 100 63 377 22 26 29 21 Get ID from Name (Search by string): records Sequenced TArray.BinS TDict CustomBinS TSynDict Spring 10 17 299 16 7 18 17 50 72 359 16 13 19 17 100 139 383 17 21 22 18 Same code compiled with XE8 and also running on the i7-8700 @ 3.2GHz Get Name from ID (Search by integer): records Sequenced TArray.BinS TDict CustomBinS TSynDict Spring 10 26 292 22 20 24 21 50 65 342 22 23 26 21 100 112 355 21 25 26 23 Get ID from Name (Search by string): records Sequenced TArray.BinS TDict CustomBinS TSynDict Spring 10 24 281 17 8 18 18 50 116 331 18 13 20 18 100 215 347 17 16 22 17 Edit - for bonus points - I fixed the TArray.BinarySearch case by using an IComparer that I prepared and stored as field because that a) solves the return stack buffer glitch caused my TDelegatedComparer and b) avoids producing an anonymous method every time that method is being called. Also got rid of the CompareValue call in BinarySearchByID, can use < and >. Running on the i5-3570k @ 3.4Ghz Get Name from ID (Search by integer): records Sequenced TArray.BinS TDict CustomBinS TSynDict Spring 10 26 64 25 21 31 27 50 52 73 26 23 32 30 100 77 84 25 23 34 25 Get ID from Name (Search by string): records Sequenced TArray.BinS TDict CustomBinS TSynDict Spring 10 22 63 25 11 27 27 50 105 81 24 18 27 26 100 205 94 24 22 29 27 -
Hello, this is the announcement that I just re-released a classic Delphi component called TComPortDrv. The new release is in agreement of the original author and the license was changed to Apache 2.0 by this. What is this non-visual VCL component about? It is an encapsulation of the Windows RS232 API so you can send and receive data via real and virtual COM-ports. The new version works from 10.4.1 Sydney onwards (due to the use of $(Auto) for the LibSuffix setting of the packages. You should get it compile on older versions though as well. Where can I get it from? https://github.com/MHumm/ComPortDriver/releases/tag/V3.0 What got changed in this V3.0 * made compilable with Unicode Delphi * fixed a severe bug in the data receive event which would overflow the internal buffer when using this component with a high baudrate (over 230400) * changed all external comments to XMLDOC * added a method to get a list of available COM-ports (only as COM3, COM4 etc. as of now) * added SetCommBreak and ClearCommBreak methods * made DelayForRX function a method now and based its calculation on the current serial settings * changed the component Icon Enjoy TurboMagic
-
Fast lookup tables - TArray.BinarySearch vs Dictionary vs binary search
balabuev replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Here is my try. I've changed a lot in existing code (mentioned early comparers, equality comparers, etc.). Also, I've replaced returned string type in functions by PString, just because otherwise string handling takes too much time and algorythms comparison becomes not interesting. As well I've added my own minimalistic implementation of hash maps (not universal). mapstest.zip -
Help to achieve multiple inheritance by class redesign
Fr0sT.Brutal replied to iiid354's topic in Algorithms, Data Structures and Class Design
I mean, in the forum. -
Fast lookup tables - TArray.BinarySearch vs Dictionary vs binary search
Stefan Glienke replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
As I already said - the high constant factor with the RTL hash function is the problem - both TDict and Spring with faster equalitycomparer from Tiny.Library - results from an i5-3570 @ 3.4GHz Also testing in the global main is garbage because you are then using global variables that cause way less optimal code - fixing that (simply put all that benchmark code into a procedure) and you get the following results Win32: Get Name from ID (Search by integer): records Sequenced TArray.BinS TDict CustomBinS TSynDict Spring 10 26 375 25 24 32 27 50 56 447 25 29 32 26 100 83 473 26 32 35 25 1000 535 585 28 83 37 26 10000 5561 753 46 130 44 30 Get ID from Name (Search by string): records Sequenced TArray.BinS TDict CustomBinS TSynDict Spring 10 21 382 28 12 30 27 50 109 466 24 18 28 25 100 206 491 24 23 31 26 1000 2044 603 30 88 39 30 10000 20532 810 36 181 49 36 Win64: Get Name from ID (Search by integer): records Sequenced TArray.BinS TDict CustomBinS TSynDict Spring 10 24 297 26 23 32 26 50 60 323 26 30 31 26 100 94 328 26 40 32 26 1000 752 381 28 85 47 28 10000 8619 427 33 128 47 30 Get ID from Name (Search by string): records Sequenced TArray.BinS TDict CustomBinS TSynDict Spring 10 61 306 24 30 27 24 50 304 342 23 41 31 22 100 620 347 23 51 31 23 1000 6466 426 31 127 52 30 10000 64263 552 38 237 58 36 -
Don't count your chickens before they hatch... I think you jinxed me there. Here's what works so far: Parse a MAP file and produce an YAML file. Convert the YAML to PDB. Update the EXE with a reference to the PDB. Not crash VTune while it's loading the PDB Here's what doesn't work: Getting VTune to use any of the information in the PDB I know that VTune reads the PDB because I can see in Process Monitor that it looks for the source files. Unfortunately the file names it looks for are the module (i.e. unit) names and not the file names and it doesn't search the source folders I have defined: I'm using VTune 2019 btw since that's the last version to support Windows 7. Anyway if you can stomach watching the sausages getting made then the current source is available here: https://bitbucket.org/anders_melander/map2pdb/ There are two projects: map2yaml and bindpdb. In addition to that the llvm-pdbutil tool is needed. The Tools folder contains a batch file that calls all three in order. Delphi 10.3 or later is required (inline vars).
-
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 -
Help to achieve multiple inheritance by class redesign
Fr0sT.Brutal replied to iiid354's topic in Algorithms, Data Structures and Class Design
Side note: that's why we need auto-wrapping code blocks -
Unless you have only Win apps and things like Win utils, FMX or more correctly cross-platform is the only way to go. The landscape in the market is vastly and rapidly changing and more platforms appear every other day. Unless you are an established large company, you can not afford to miss the opportunity of jumping into new markets quickly and with limited resources. We should not judge FMX's state and value based on what DevExpress says. I think their decision is more of a business one rather than a technical. Their clients are VCL develops and to me it is not a surprise that not many of them have adopted FMX. In fact, it is surprising they concluded there is no market for them. To me it seems very short-sighted understanding of the market. I am sure if they insisted, in 2-3 years their evaluation would be different. And I am also pretty sure when they started with the VCL suite, they had to iron out bugs, etc. But back then they were not the company they are now. Having said this, I have to mention here that I am not pleased with the way EMBA sees FMX either. I understand that most of Delphi clients are largely VLC developers. On the other hand, EMBA promotes Delphi as the one code base cross platform dev tool and yet they mostly focus on the introduction of new VLC products. This is a mess with their strategic priorities and every time I attend the webinars for new releases, I am disappointed to see they continue with the same approach. For example, they introduced a new TNumberBox---why is this not a FMX and VLC compoent? or the Control list?