• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

Exe Size Comparisons With Different Compilers

Started by Frederick J. Harris, September 11, 2009, 04:57:47 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Charles Pegge


The minimum section size in a PE file is 512 bytes but the memory image size goes in steps of 4k. So with the PE header, the code section, the import and export sections and the data section this will be 20k, - possibly double this under Vista.

Jeff Blakeney

Using Patrice's code I get a size of 6656 not 6556.

#OPTIMIZE SIZE doesn't have an effect on this program but could have an effect on larger programs and no one has mentioned using this option when testing PB programs.

The absolute smallest program you can get is:

#COMPILE EXE
FUNCTION WINMAIN (BYVAL hInstance AS DWORD, BYVAL hPrevInstance AS DWORD, BYVAL lpszCmdLine AS ASCIIZ PTR, BYVAL nCmdShow AS LONG) AS LONG
END FUNCTION


or

#COMPILE EXE
FUNCTION PBMAIN
END FUNCTION


Both compile to 5120 bytes and all they do is start up and immediately shut down.

Frederick J. Harris

Just the other day I drug out my old PB 6 disks (floppies!!!!) and installed it on one of my XPs.  My basic template app which includes my usual function pointer message cracker scheme & whatnot came in at 11K without doing anything special do eliminate stuff.  That's about 6K less than with PB9.  I've honestly been considering using that some because most of the stuff I do doesn't involve anything especially modern or high powered.

Patrice Terrier

#18
Yes, 6656 is the correct size (6556 was a typo).

#OPTIMIZE SIZE over #OPTIMIZE SPEED, i never see a big difference when used with SDK code.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Theo Gottwald

QuoteI've honestly been considering using that some because most of the stuff I do doesn't involve anything especially modern or high powered.

Is it a Question of honour, Fred?

Because I don't know what device you are coding for, but if its todays PC's, even a programm with 6656 will fit into a todays keyhole. If Bob would call me and ask me "Shall I use a day to crimple the runtime into pieces and only link the needed parts", I'd tell him to do something useful instead. Maybe make PB 64...

Emotionally I understand you idea, maybe thats why we use PowerBasic.
But seen under modern light, 6 kb is just the shit of a fly.

Frederick J. Harris

Yes, you are right Theo.  I havn't had PB 6 on any of my computers for years, but I had to reinstall it just recently to deal with a vary large old project that had never been upgraded.  Over the years though, I have occasionally wondered if there were any compelling reasons to use older versions of software when money wasn't really an issue and when one even had the newer versions.  I recall Chris Boss mentioning several times that he still used PB 6. 

There certainly aren't very many bugs with the PowerBASIC compilers, so its usually not an issue of justifying the newer compiler in terms of hopes that some particular bug might have been fixed.  Its predominently an issue of newer features - such as COM support.

I have always greatly appreciated the small sizes of both my PowerBASIC and my C++ programs.  Some of them are used in network settings, so a 600K program loads over a network much faster than a 6MB one.   

Chris Boss

The standalone sprite engine I am currently work on is written using PB 6.01.
It compiles to about 47 KB.

When compiled using PB 9.01 it compiles to about 58 KB.

So when trying to compile very small DLL's, later versions of the PB compiler will add some extra runtime code so they will be larger.

Since I don't need the extra features of PB 9.01 (ie. DDT command set) since I use the Windows API exclusively, the older compiler saves a bit on the final size of the app.


Patrice Terrier

#22
Older compiler like 6.01, do not work on 64-bit computers.

I, for myself, would like to have a bare bone compiler without extra features (or with a switch to turn them off) ;D

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com