Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 357
  • Last Modified:

Reducing size of Delphi exe file

I have written a program in Borland Developer Studio 2006 for Win32. The program is based on the PageControl component. My PageControl contains 12 TabSheets. Each of these TabSheets has a number of database aware components - edit boxes, radio groups and so on, maybe an average of a dozen components per TabSheet. The executable is massive at over 7 MB. It takes about 2 minutes just to load. After loading, it works well enough. But the loading takes so long, one gets the impression the program has hung up. To streamline it, do I need to create the components (or the Tabsheets) dynamically when I need them? Rather than creating every page at design time? If that's what I need to do, what would be the steps I would need to go through and would it be a huge task or something quite quick and easy (I'm a casual Delphi programmer not an expert!).

Regards,
Peter
0
riskassessor
Asked:
riskassessor
  • 5
  • 3
  • 2
  • +2
8 Solutions
 
sun4sundayCommented:

Everything getting loading in your applicaiton. Also the Applicaiton eats lots of memory.

Instead of 12 Tabs it is better to use the Forms and create those forms dynamically.
Create a main form and navigate it from to other forms. You can create form dynamically when to navigate.

Go to    Project>Options>Forms> move all the created froms to left to right except the Main form.

Also try to use  datamodule to place the DB components.
Don't open the all the tables in the begining of the applicaiton. Open the tables only when it is needed.

Instead of Tab and creating the form dynamically will load the application quickly.


Hope this helps

sun4sunday
0
 
riskassessorAuthor Commented:
Those sound like good suggestions - but would I have to recreate the user interface from the beginning? Is there any way I can quckly convert what I already have to a more efficient program?
0
 
sun4sundayCommented:
>>It takes about 2 minutes just to load.
This is too long for an an applicaiton to just to get load.
What I suggested is  to reduce the loading time/performance of the applciaiton.

In my view Loading time is more important than the size of the exe.

If you want reduce the size
http://upx.sourceforge.net/   or use ASPACK

or u have to go with WinAPI coding.

Also cross check this
Project|Options and select the Linker tab, set Map File to Off, set Linker Output to Generate DCUs and untick all the EXE and DLL options.

sun4sunday
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
riskassessorAuthor Commented:
I agree - the loading time is the biggest problem since it seems to run fast after loading. But I already have Map File off and Linker Output to Generate DCUs and the EXE and DLL options are already unticked, so that suggestion is already implemented and it's still slow to load.
0
 
sun4sundayCommented:
Have you opening all the tables when you are loading the applicaiton. If so, change that according to the above post.
>>Is there any way I can quckly convert what I already have to a more efficient program?
Witth out modifying anything, the loading time will not get improve.
The first thing is the enitre bulky form with all the tabs, If you can change it to the form and open necessary tables on the right time . Hope that will resolve the problem

By the way is how old is the comptuer at the client side? If it is old the performance will effect.
Also if your data retriving throught the network, then the spped of the network also a factor to open your applicaiton.

sun4sunday
0
 
sun4sundayCommented:
>>, so that suggestion is already implemented and it's still slow to load.

This is one reason to get the exe bulky. in your case it is ok.

Check othe r two suggesions :) Move Tas to forms and change all tables opes in the begining.

sun4usunday
0
 
sun4sundayCommented:
Also if your database is fresh, (means very few records in it) and once your databse grows, the opening the tables will  take more time and it will effect the opening time of the application.

sun4sunday
0
 
atul_parmarCommented:
1. If there is NO optimization scope then create a beautiful sphash screen and show the loading progress. This will not reduce the loading time but sure it will not get an impression of hanf up
2. Having dozens of components doesn't affect much in loading time. I mean it doesn't take much time to create them all.
3. The most time taken is by creating and opening database connections, opening tables, filters, master-details tables etc. So delay the opening of tables as much as possible. e.g. The table used in tab2 ...tabN can be opened only when needed (i.e. when user clicks that tab)
4. To reduce the exe size,
    1. remove the units from uses list which you are not using.
    2. when you compile your final exe, turn the debugging off
0
 
mikelittlewoodCommented:
1st of all, take all the unused units of your uses clause.

Another thing that you can and definitely SHOULD do is to turn off the compile with debug information.
If you are using any resources, such as bitmaps,wav's etc... compile them separately as resource files.

When ever you can, create dynamical forms and components.
Could also use http://www.neoworx.com/neolite/download.asp and try it out!
NeoLite will compress EXE / DLL / OCX files while maintaining optimal performance when executed

Go get the free UPX exe compressor
http://www.nexus.hu/upx/ 
0
 
mikelittlewoodCommented:
I think I have re-iterated a few of atul_parmar's points from before I just noticed. Sorry about that atul_parmar.

But check out the other 2 applications from reducing exe's.
0
 
David_WardCommented:
Heres a thought ......

You could try compressing it with something, like, say, UPX.
UPX is shareware and should compress your EXE to at least one third of its' current size.

0
 
David_WardCommented:
p.s. you can find it here:

http://upx.sourceforge.net/
0
 
riskassessorAuthor Commented:
Thanks to all who helped me on this. I think the key to reducing the EXE file size and the loading time is to dynamically create forms when needed and then delete them when done as Sun4Sunday pointed out. No one answered my question on the steps for doing this but I have managed to figure it out and the program is well on the way to being rewritten. It is a fraction of the former size and loads almost instantly. I may also use an EXE compressor so thanks to those who pointed that out. I have split the points between all who gave useful help. Thanks again.
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 5
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now