Leaderboard
Popular Content
Showing content with the highest reputation on 10/29/23 in Posts
-
Storing a large amount of elements in a 50k lines unit
Remy Lebeau replied to Clément's topic in Algorithms, Data Structures and Class Design
Why are you hard-coding so much data directly in your source code to begin with? Why not simply store the data in an external file or database and then load it from there at runtime? If you absolutely need the data to be present statically in your app's executable, I would suggest having the auto-generator store the data in a separate file that is then linked into the app's resources at compile time, and then you can load the data from that resource at runtime. This much data really DOES NOT belong in the source code directly at all. Another benefit of this approach (using either a file, database, resource, etc) is that you can update the data on the user's machine without having to deliver a new executable from your dev machine every time (in the case of using a resource, there are plenty of 3rd party tools available to update an app's resources directly). You can, of course, also update the data on your dev machine and recompile if you really want to. -
Is it a problem if I create more threads than host CPU has ?
Dalija Prasnikar replied to William23668's topic in General Help
CPU is a finite resource. You will not get more of it, by throwing in more threads. If there are more threads than CPU cores, those threads will compete with each other for CPU time, and switching between threads also costs some CPU time. So after you overload the CPU, more threads you add the slower it will work. Only if threads are doing some I/O bound work, then you can have more such threads than CPU cores and possibly whatever you are doing can finish in less time. In other words if the thread spends most of the time waiting for some slow I/O operation, then such thread will not fully utilize CPU core and other threads can do useful work in the meantime on that core. However, even in I/O bound operations, there are limitations and if those threads are competing for the same resources, then again, the whole process will run slower. Imagine that CPU core is a shovel and threads are workers. In CPU bound work workers need to dig some ground. If you have same amount of shovels as workers than each worker will use the shovel all the time without having to give it up and it will be able to do the digging at full speed. If you have more workers than shovels, then workers will compete for that shovel. And it will not be in a way that some workers will use the shovel all the time and others will do nothing, but each worker will get very short time to use the shovel, maybe only taking one or two loads, and then it will have to give the shovel to the other worker that is waiting. But transferring shovel from one worker to another takes time, and at the end everything will run slower than if you have only one worker per shovel. On the other hand, if the worker also needs to use a pickaxe, then while worker is using the pickaxe, he does not need the shovel, and someone else can use it until the worker is done with the pickaxe. This is example of I/O bound work, where pickaxe is some I/O resource (network, disk...). Again, if you have more workers that compete for the pickaxes, the whole thing will work slower than single worker using that pickaxe. Now, this is simplified example. When it comes to your application running, it is not just your application that uses the CPU cores, but OS and other processes and applications are also using them, so you also need to take those into account. Now finding the right balance for the actual work can be hard and will depend on other parameters, and usually you don't have to optimize that much. But in simple terms, you definitely don't want to have more threads working at the same time than CPU cores, if those threads are doing CPU bound work. Commonly using as much threads as CPU cores or one less, will do - you can experiment with that, but again this is something worth pursuing for most applications. If you are writing something that will run on specific hardware then you can more easily optimize, but if you need to make it work across different ones, then good optimization for one may be a bad optimization for another. -
Storing a large amount of elements in a 50k lines unit
Clément replied to Clément's topic in Algorithms, Data Structures and Class Design
I meant, I couldn't release the application the way it is now ( 50k unit file). I will generate an external file, and load it at start up.... so a Beta V is on the way. -
Storing a large amount of elements in a 50k lines unit
Remy Lebeau replied to Clément's topic in Algorithms, Data Structures and Class Design
Why not? The user won't notice a difference, and your code/project will be easier to manage. You are loading the Dictionary at runtime anyway, so what does it matter where the data originates from at runtime? Make things easier on yourself. -
Storing a large amount of elements in a 50k lines unit
Anders Melander replied to Clément's topic in Algorithms, Data Structures and Class Design
No; I think our scorn for this design choice will be limitless 🙂 https://en.wikipedia.org/wiki/Trie And store the data in a resource. -
Copied text from posts contains garbage character
KeithLatham replied to Stefan Glienke's topic in Community Management
Invisible Formatting -
DEC and FPC compatibility
Remy Lebeau replied to TurboMagic's topic in Algorithms, Data Structures and Class Design
Can you be more specific? What is the actual issue? Indy uses a mix of IFDEF/ENDIF and IF/IFEND, and it works fine in both Delphi and FPC. You might consider turning on LEGACYIFEND in Delphi XE3+, if you are not already doing so. -
Delphi Code Coverage WIzard Plus V2.0 released
TurboMagic replied to TurboMagic's topic in Delphi Third-Party
This is the information that I added a few things in development branch of this tool lately. I updated the command line code coverage tool used and started to add the new parametrs it provides. I haven't yet added all and I don't think all make sense for this tool, but you might still want to try it out. I haven't tested those additions yet, as I don't fully understand yet how they must be used from that bit of documentation provided for them and now I have lack of time, but I still hope they're usefull as is. So if I get feedback on them (and I didn't completely missunderstand those) I might still get a new release together soon. Cheers TurboMagic -
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:
-
Storing a large amount of elements in a 50k lines unit
FPiette replied to Clément's topic in Algorithms, Data Structures and Class Design
I don't know which processing you need to do with the data. I guess it is a simple lookup. Instead of loading the data into a TDictionary, you could use a SQLite table and use SQL request to do the lookup. With SQLite, the SQL engine is linked with your executable and there is zero installation. It is also very fast. -
It is not a bug, and it is not the SSLIOHandler that is changing the Port. It is actually the UseTLS property setter that does it. You are initializing the Port to the standard IMAP port 143, then setting UseTLS to utUseImplicitTLS, so the property setter changes the Port to the standard IMAP implicit TLS port 993. This is working as designed. If you need to use implicit TLS on port 143 (why?), then you need to set the Port after setting the UseTLS.
-
Storing a large amount of elements in a 50k lines unit
Attila Kovacs replied to Clément's topic in Algorithms, Data Structures and Class Design
I can't remember which unit it was, and which Delphi release, but there was a constructor similar to this where some graphics or hash table was filled with thousands of lines. After a certain size, the compiler silently cropped the code and linked the exe without any error. Nevertheless, I would rewrite the generator to produce 16 (0-F first byte) array constants, sorted by the MAC address rather than the vendor. Additionally, I would substitute the vendor string with a lookup table to eliminate the redundant entries. -
I downloaded the main code only. Based on your recommendation, though, I'll break with policy and try out the PR. Thank you, Remy. [Update] It worked. I see what you mean about the design time properties. It doesn't allow for explicitly configuring the IO handler for TLS 1.3, but if I make a connection to a server that implements 1.3, it works. That's good enough for now. Thank you, Remy and Mezen, for your hard work!
-
For Android, this is the only way I've found that will quit completely and remove the task from the "recent items" list: https://github.com/DelphiWorlds/Kastri/blob/64a5600e0845862f3e3991cd1708dee82a65ff45/Core/DW.Android.Helpers.pas#L561 For iOS, it's bound to have your app rejected if it is on the App Store, otherwise: https://developer.apple.com/library/archive/qa/qa1561/_index.html
-
I used AQTime for many years, but it seemed to me that SmartBear wasn't really interested in the Delphi market and their product suffered ... and was expensive. I more recently purchased Nexus Quality Suite and was very happy with it. Great tool, great support, great modern product: https://www.nexusdb.com/support/index.php?q=node/27156. As someone previously said, "You get what you pay for." NQS was well worth what we paid for it.
-
Is it a problem if I create more threads than host CPU has ?
William23668 replied to William23668's topic in General Help
You dont know my exact needs so go educate yourself how computer work and keep st upid comments to yourself