What can influence Delphi executable size?
Asked Answered
O

7

8

I have the very same delphi version, bpls, components, everything. And yet in three machines the resulting executables are different in size. What else can influence in the size of the exe?

In my machine I get this size (Vista 6.0.6001):

4.547.584 bytes

In my colleague's machine, he gets (XP 5.1.2600 SP3):

4.530.688 bytes

In a third colleage, he gets: (XP 5.1.2600 SP2)

4.527.104 bytes

Does the OS version influence in the compiled exe size?

Overflow answered 11/11, 2008 at 17:22 Comment(4)
Big differences? Can you give examples?Obsess
vlceBerg, added examples like you asked.Overflow
Same OS version? Same SP installed? Same filesystem?Obsess
added so information. does it influence in the exe size?Overflow
Q
10

It would seem that it is configuration differences, or if maybe you have different versions of components installed between the three machines. I would suggest creating a blank form and trying it on all 3 after you verify that the build settings are the same. If that is the same then add some 3rd party components until you find the one that is different.

Additionally you may have a different version of Delphi (major or minor/update version).

Quindecennial answered 11/11, 2008 at 19:39 Comment(3)
Thanx Jim. Will try it and post results ASAPOverflow
Sorry, Jim. Not correct. <g> See my post for links that explain why.Mitchellmitchem
Actually Ken, it could be both, but I was not aware of the issue you pointed out.Quindecennial
E
7

The differences almost certainly come from different compiler settings between the machines. For instance, turning Range Checking on or off will slightly alter the resulting size of the executable.

One of the nice things about the more recent versions of Delphi is the use of MSBuild, which can easily ensure that the settings for any given build are the same.

Eb answered 11/11, 2008 at 18:17 Comment(1)
Our DPR files are the very same, for sure. Range checking is a project option. I can't see any IDE option that could interfere in the size of the resulting executable.Overflow
R
4

Hmmm...

SizeOf(XPSP2.exe) < SizeOf(XPSP3.exe) < SizeOf(Vista.exe)

Conclusion:

The later the version of Windows, the more "filler" is randomly inserted to add credibility. If it takes more space then it must be more powerful, and it was probably coded by the best engineers in the world! :-) (sorry - I've been working at Microsoft for too long!)

Rhizobium answered 10/6, 2009 at 5:28 Comment(1)
this is definitely a statistical trend :)Warbler
D
3

With Delphi/BCB these are a few factors that can influence size:

Your Build Configuration: Release Mode does not link in the debug section into the EXE (by default) so is smaller. also you may get a boost from code optimization.

Linking with Dynamic RTL: If enabled you EXE will be smaller but you will require the external libraries to be available.

Building with Runtime Packages: If enabled, you dynamically link to the runtime packages you use instead of linking them directly into your EXE. This can result in the largest size differences.

Their are other factors but the above tends to be the main ones I come across.

Disruption answered 11/11, 2008 at 17:31 Comment(1)
Steve - that's a great answer to a totally different question ;-)Jecoa
S
1

IIRC, re-compiles after making minor changes may also leave cruft laying around - one fo the side effects of the smart compiler, I guess :}

Slink answered 18/12, 2008 at 22:11 Comment(0)
M
1

Actually, it's a issue that's been around for quite some time. See

CodeGear Quality Control

Borland Delphi newsgroups

Recent discussion of this on Delphi newsgroups (http view).

It has absolutely nothing to do with differences in component installs or anything like that; in fact, the last reference mentions something to do with timestamps that are inserted into the application on each compile/build. Also, if you're doing a build and are including version info, and have the build number set to autoincrement, this will cause binary differences as well.

Mitchellmitchem answered 13/3, 2009 at 17:59 Comment(0)
D
0

Actually it's much more interesting than than.

Even re-building the same application on the same machine, several times in succession, making absolutely NO changes to the configuration whatsoever in between compiles, produces executables of slightly different sizes. I built a particular project 10 times and obtained 10 (!) different executable sizes - a different size every time!

I've noticed that the phenomenon only occurs on projects of sufficient size/complexity, though.

If you do this on a relatively simple project, the executable will be the same size, even though there will still be internal differences (if you do a binary compare). I don't have the time to investigate this right now, but I am mildly curious.

Notice that merely doing a compile, i.e. effectively just re-linking the application, does not change the size of the resulting executable, but it does change its content (binary files generated are not identical).

Dipteral answered 13/3, 2009 at 17:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.