Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Reducing size of Delphi exe file

Posted on 2006-06-19
13
Medium Priority
?
355 Views
Last Modified: 2010-08-05
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
Comment
Question by:riskassessor
  • 5
  • 3
  • 2
  • +2
13 Comments
 
LVL 9

Accepted Solution

by:
sun4sunday earned 900 total points
ID: 16936868

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
 

Author Comment

by:riskassessor
ID: 16937147
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
 
LVL 9

Assisted Solution

by:sun4sunday
sun4sunday earned 900 total points
ID: 16937393
>>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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:riskassessor
ID: 16937460
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
 
LVL 9

Assisted Solution

by:sun4sunday
sun4sunday earned 900 total points
ID: 16939283
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
 
LVL 9

Assisted Solution

by:sun4sunday
sun4sunday earned 900 total points
ID: 16939304
>>, 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
 
LVL 9

Expert Comment

by:sun4sunday
ID: 16939345
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
 
LVL 10

Assisted Solution

by:atul_parmar
atul_parmar earned 150 total points
ID: 16940243
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
 
LVL 15

Assisted Solution

by:mikelittlewood
mikelittlewood earned 150 total points
ID: 16941304
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
 
LVL 15

Expert Comment

by:mikelittlewood
ID: 16941744
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
 
LVL 4

Assisted Solution

by:David_Ward
David_Ward earned 300 total points
ID: 16958804
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
 
LVL 4

Assisted Solution

by:David_Ward
David_Ward earned 300 total points
ID: 16958817
p.s. you can find it here:

http://upx.sourceforge.net/
0
 

Author Comment

by:riskassessor
ID: 16961311
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

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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Screencast - Getting to Know the Pipeline
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question