01-22-2026, 04:37 PM
(01-22-2026, 12:26 PM)ahenry3068 Wrote: Who can explain such a difference in size between all these executables (which BTW proves that C is more efficient than C++ even for such a tiny program)?
This only proves that higher tier languages package more functions into the EXE than others.
When you compile a QB64 program, you don't just get the code you wrote; you get every function which is attached to QB64.
You didn't use TAN, but it's in there.
You didn't use _PRINTSCREEN, but it's in there.
You didn't use _MEM, but it's in there.
You didn't use $RESIZE, but it's in there.
*ALL* The functions in QB64PE are neatly packed up and attached in the source code that you compile, in case you *DID* want to make use of them.
Them all sitting there, however, has very little impact on the actual program that you're running.
Code: (Select All)
PRINT "Hello World"
SUB SORT
SUB OPENFILES
SUB EATCHEETOS
SUB FOO
SUB FOOFOOFOONow my program above has one command to execute and half a dozen subs. Since it never calls out to those subs, their impact is really minimal on the performance of the program itself. They might affect memory usage by sitting around when they don't have to, and they might affect load times of the program by 0.001 nanosecond on today's hardware, but as for performance?
They're just unreferenced memory that never gets accessed or called to.
There's no real reason to take the effort to strip them out of every EXE you compile. Just leave them there and forget about them.
So... in the end you get a larger EXE, but performance wise, it performs exactly the same as the smaller program. It just has a bunch of stuff sitting in it which you "COULD" have used, but never did.
That's the difference in the compiled sizes. The more things you can just plug in and let the language do for you, even if you use those things or not, the larger the EXE is going to end up being. It doesn't really affect performance, but it does affect flexibility.
Try to write a nice program of any complexity in C, without importing a single library into it. Draw a "Hello World", make it a graphical image, and then rotate it 360 in a circle.... without any library usage whatsoever. I can do it in QB64 in 3 minutes from start to finish because all the tools are already there. How long would it take to code that from scratch in C?

