• Welcome to Valhalla Legends Archive.
 

[VB6/C++] Interesting size comparison..

Started by Joe[x86], August 25, 2005, 03:37 PM

Previous topic - Next topic

Joe[x86]

http://www.javaop.com/~joe/WindowStuff.zip

In that zip, theres two EXE files that do the exact same thing: create a window. The source code to both is included (its Bloodshed Dev-C++ source code). I saw that in both source code and compiled form, the VB files are smaller. I find that rather interesting.
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

Newby

Uh, I'm not sure how Bloodshed Dev-C++ works, but is that .exe by any chance, a debug and not a release? :p
- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

iago

Also, note that VB uses mostly library functions, ocx stuff.  Whereas C++ may or may not be statically linked.  That would also inflate the size of the .exe.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


MyndFyre

Click here, noob.
Total executable size (in release folder): 3072 bytes.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

R.a.B.B.i.T

Also if your compiler was optimizing for speed instead of size, that could be a factor ;\

Topaz

What's the big deal about file sizes? It doesn't matter, as long as your application does what it's supposed to.

If all else fails, you can always use a file compressor like UPX to shrink its size for you.

Joe[x86]

Newby: Could have happened. I don't think so though.
iago: Er, hehe.
Rabbit: Another possibility, but *anything* should beat VB's optimizer =p. Even my JoeBASIC compiler beat it, heh.
Topaz: I was just saying, VB beat C++, which has always been held as better than VB at file size.
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

iago

To all the people who said it doesn't, you're incorrect: the size of an .exe does matter. 

The bigger a program is, the longer it will take to initially load it into memory.  So if you have an exe that is very large, and you run it, it will take a lot longer to load because it has to be read from the harddrive into memory before it can be run.  Once it's there, if it's large, it might get swapped out to the harddrive (due to lack of memory) which will slow down the execution.  So smaller .exe's are good. 

For example, look at Firefox.  It's statically linked against all its libraries (to make sure that it's fully portable), and as a result it has a ~12mb memory footprint.  But it runs fast once it's loaded, if you have a decent amount of free memory, because of the first mitigating factor below:

There are, however, a couple of mitigating factors:
- A big exe that is statically linked won't have to load many dynamic libraries.  That means that it will load reasonably fast, since it doesn't have to load libraries, and won't take up as much memory as could be expected.
- If an exe is optimized for speed, then yes, it will initially take a little bit longer to load.  However, because the compiler does things like inline functions and unroll loops, you will get a significant speed increase while running.  This will almost certainly be enough to offset the extra loading time. 

So it's really a catch-22.  It makes a difference, for sure, but it's a trade-off. 

This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Archonist

Quote from: iago on August 26, 2005, 08:37 AM
To all the people who said it doesn't, you're incorrect: the size of an .exe does matter. 

The bigger a program is, the longer it will take to initially load it into memory.  So if you have an exe that is very large, and you run it, it will take a lot longer to load because it has to be read from the harddrive into memory before it can be run.  Once it's there, if it's large, it might get swapped out to the harddrive (due to lack of memory) which will slow down the execution.  So smaller .exe's are good. 

For example, look at Firefox.  It's statically linked against all its libraries (to make sure that it's fully portable), and as a result it has a ~12mb memory footprint.  But it runs fast once it's loaded, if you have a decent amount of free memory, because of the first mitigating factor below:

There are, however, a couple of mitigating factors:
- A big exe that is statically linked won't have to load many dynamic libraries.  That means that it will load reasonably fast, since it doesn't have to load libraries, and won't take up as much memory as could be expected.
- If an exe is optimized for speed, then yes, it will initially take a little bit longer to load.  However, because the compiler does things like inline functions and unroll loops, you will get a significant speed increase while running.  This will almost certainly be enough to offset the extra loading time. 

So it's really a catch-22.  It makes a difference, for sure, but it's a trade-off. 



Size does matter.  ;) What makes an impression on me with a program, is it's load time and memory usage.

Blaze

Quote from: Krazed on August 26, 2005, 03:14 PM
Size does matter. ;) What makes an impression on me with a program, is it's load time and memory usage.
but not its productivity, or useability?
Quote
Mitosis: Haha, Im great arent I!
hismajesty[yL]: No

Newby

Quote from: Joex86] link=topic=12619.msg125527#msg125527 date=1125055500]
Topaz: I was just saying, VB beat C++, which has always been held as better than VB at file size.

Did you read Myndfyre's post?
- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

MyndFyre

Quote from: Newby on August 26, 2005, 04:28 PM
Quote from: Joex86] link=topic=12619.msg125527#msg125527 date=1125055500]
Topaz: I was just saying, VB beat C++, which has always been held as better than VB at file size.

Did you read Myndfyre's post?

I think the really important one to read is the one about static vs dynamic linking.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.