Author Topic: Exe Size Comparisons With Different Compilers  (Read 12699 times)

0 Members and 1 Guest are viewing this topic.

Offline Charles Pegge

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 678
  • User-Rate: +27/-1
    • Charles Pegge
Re: Exe Size Comparisons With Different Compilers
« Reply #15 on: September 12, 2009, 10:30:10 PM »

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.

Offline Jeff Blakeney

  • Newbie
  • *
  • Posts: 11
  • User-Rate: +0/-0
Re: Exe Size Comparisons With Different Compilers
« Reply #16 on: September 13, 2009, 12:28:26 AM »
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:

Code: [Select]
#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

Code: [Select]
#COMPILE EXE
FUNCTION PBMAIN
END FUNCTION

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

Offline Frederick J. Harris

  • Hero Member
  • *****
  • Posts: 914
  • User-Rate: +16/-0
    • Frederick J. Harris
Re: Exe Size Comparisons With Different Compilers
« Reply #17 on: September 13, 2009, 06:51:19 AM »
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.

Offline Patrice Terrier

  • ROMs
  • Hero Member
  • *****
  • Posts: 934
  • User-Rate: +62/-1
    • www.zapsolution.com
Re: Exe Size Comparisons With Different Compilers
« Reply #18 on: September 13, 2009, 07:58:59 AM »
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.

...
« Last Edit: September 13, 2009, 08:18:33 AM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 935
  • User-Rate: +30/-4
    • it-berater
Re: Exe Size Comparisons With Different Compilers
« Reply #19 on: September 17, 2009, 05:57:25 AM »
Quote
I'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.

Offline Frederick J. Harris

  • Hero Member
  • *****
  • Posts: 914
  • User-Rate: +16/-0
    • Frederick J. Harris
Re: Exe Size Comparisons With Different Compilers
« Reply #20 on: September 17, 2009, 08:33:06 PM »
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

  • Guest
Re: Exe Size Comparisons With Different Compilers
« Reply #21 on: September 18, 2009, 08:33:46 PM »
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.


Offline Patrice Terrier

  • ROMs
  • Hero Member
  • *****
  • Posts: 934
  • User-Rate: +62/-1
    • www.zapsolution.com
Re: Exe Size Comparisons With Different Compilers
« Reply #22 on: September 19, 2009, 09:00:54 AM »
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

...
« Last Edit: September 19, 2009, 09:05:33 AM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com