Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Coding to make EXE small as possible
Message
From
02/11/2000 11:18:42
Walter Meester
HoogkarspelNetherlands
 
 
To
02/11/2000 04:23:08
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00437025
Message ID:
00437152
Views:
18
Tim,

>In effort to code effeciently I have some questions about what makes
>an exe more effecient and smaller...
>
>- I heard that code in PRG files is more compact then code in forms...
>- Exclude all unnecessary files from project..
>- Do comments really get not compiled into the exe?

If you toggled the debug info checkbox of your project to on, everything in your classes (comments included) and forms will be compiled into your exe. In fact in your exe you could easely say:
USE Myform.scx 
BROWSE NORMAL

OR 

USE Myclass.vcx
BROWSE NORMAL
When the debuginfo is unchecked all sourcecode is stripped from the forms and classes.

PRGs are much more space conservative. They do not contain the full sourcecode not overhead that classlibaries contain. But since class libaries are much easier to handle, moving from classlibaries to classes in PRG is not an option.

>- Would for example making shorter names for things make the exe smaller.

Another space eater is the properties field in classes and forms. When using containers (containers, pageframes, pages etc,) with long names it will increase the size of the contents of the propertiesfield. So try to avoid long names for containers with lots of objects in it.

The properties fields in both classes and forms tend to contain more information than neccesary. VFP tends to set the name for each object while it already has the same name. You can easely strip these lines from this field.

This also applies to other properties which are already set to a specific value by default. You won't need these ones either.

>-What other practices should be used to code effeciently from a point of view
>of shrinking the EXE file..

Forms which contains objects derived from classes have filled the classloc field for those objects. If your application has the proper SET CLASSLIB TO commands in the startup of your application you won't need the info in the classloc field as well. You can safely clear them. Remark, when opening the form again for design, be sure that the same SET CLASSLIB TO commands are in effect.

Much of the info you can strip from forms and classes are automaticly added when you reopen then for design. The best you could do, is to use some programs which remove the unneccesary code from classes and form.

When you look in your forms and classes directories you see the sizes of each form. If you can reduce 10kb of a particular form.scx, you save 10Kb in your exe (if debuginfo is toggled on).

Another strategy to save memory, is to use classes for each object that is used more than ones in the project. If for example you've got to display certain info at more than one place, just place it a container class and use that class more than once.

If you're really interested in this topic, just open a few of your personal classes and forms as a table and check for yourself where and how you could save space.

HTH

Walter,
Previous
Reply
Map
View

Click here to load this message in the networking platform