Mega Code Archive

 
Categories / Delphi / Examples
 

Speed up delphi

Delphi 4 was the slowest Delphi we have ever seen, and Delphi 5 is not really faster, nor was Delphi 3. Beside these versions, I'm still using Delphi 2 for some special tasks and every time I start it I'm amazed by its incredible loading and general processing speed compared to the newer versions. And although the raw compile and linking times have not increased measuruable, the required resources Delphi 3/4/5 occupies make even that quite slow, especially at the first compile after starting Delphi. Why? Well, the main reason for Delphi's behaviour is the design of the OS under which it runs: Microsoft Windows. Windows can be seen as the most "bloated" of today's operating systems, containing an incredible amount of useless code, "funny" graphics, animations and all the stuff which is required to keep even foreground threads slow and resource-hungry. Beside that, especially Delphi 3/4/5 itself has many built-in features which make it slow, which can produce quite long "thinking pauses" from time to time and susceptible for memory overflows. The goal of this section in my FAQ is to provide you a number things you could check and avoid to prevent unnecessary resource consumption of the IDE. Note: this section is not thought to provide you with tips that help to avoid unnecessary resource consumption of your apps themselves. For that, please check the sections "speed up your app and save resources" or "reduce the .EXE-size of your app" on this page. develop under Windows NT. Windows NT comes with a better memory management than Windows 95/98. put Resource-Meter (rsrccmtr.exe) in the tray area of your Windows Desktop. This helps you to gain control about the point where Windows's resources are filled up and after which the desktop "dies" so that you can close other apps or opened forms before this happens. don't keep too many forms open while you are working in the IDE. Each opened unit and form eats up resources - especially complex multi-page forms can easily fill up to the half (!) of the available memory. After that, not only your harddisks will have to do heavy work, but also you risk hanging your PC when you run your app from within the IDE. Check "Minimize on run" in the Environment options of the IDE. This will help to minimize fragmention of the Windows resources. disable unneeded "Code Insight" features for these features, Delphi has to constantly open and lookup libraries, pop up hint windows etc. etc. .. all stuff which will slow down your working speed a lot. If you need these features, check out the related keyboard shortcuts - they will give your Delphi the same power, but prevent making it unnecessarily slow. remove all unneeded components and packages from the IDE. Each installed package and component uses valuable resources - even if you never need it and it's "just a button" in your Delphi toolbar. And not only that - it also slows down your Delphi startup a lot since Delphi does a lot of internal reference checking when loading the required stuff. turn off Code Explorer. Treeviews are slow by design. Turn off Delphi's built-in Treeview if you don't really need it (you can still turn it on manually via "View"-"Code Explorer"). finally: give Windoze at least 64 MB. with less than that, programming with Delphi 3/4/5 is a pain and you might end up as a trembling individual in a mental clinic. more tips? Please let me know!