Page 1 of 1

general rules to get smaller (tiny) executables ?

Posted: Mon Jun 21, 2004 9:30 pm
by newbie
Hi,

I am an optimizer freak (I don't say i am good at it lol), and I want to have the smallest/fastest executables possible.

I have noticed that by using APIs althernative to the PB internals command, my executables size were decreasing (ex, MessageBox API instead of MessageRequester).

To remove the error checking also reduce the executable size (OnErrorGoto).

I would like to know other tips to decrease the executable file size, I'm sure you can save again size with the window creation, but I think it would complicate the code may be too much ?

Please give all your tips and share them with us, I'm sure there is other people interested in :D

EDIT : to Fred or other administrator/moderator, I am able to post it as a "post it", I think my forum allowances aren't set correctly ;)

Posted: Tue Jun 22, 2004 2:53 am
by Shannara
Do not use any windows or gadgets :)

Posted: Tue Jun 22, 2004 2:56 am
by El_Choni
And only use the API. But it's much easy to code with PB commands, and executables are still small, IMHO.

Posted: Tue Jun 22, 2004 11:50 am
by newbie
I was surprised with PB 3.91 beta2 to have a 2KB executable only if I just put a MessageBox_() API call, that's the same size than an executable written directly in ASM 8O

Of course I know I can't have such tiny executable while writing a real full program, with at least a window, and no I don't want to write my progs in ASM, PB is my favourite :wink:

I use to do small progs (more "tools" to use from time to time than full proggies) and then I have a 40KB executable, to make it decrease to 30KB is nice ;)

..

Posted: Tue Jun 22, 2004 1:26 pm
by NoahPhense
newbie wrote:I was surprised with PB 3.91 beta2 to have a 2KB executable only if I just put a MessageBox_() API call, that's the same size than an executable written directly in ASM 8O
That's probably because PB spits out very good optimized asm.

- np

Posted: Tue Jun 22, 2004 1:31 pm
by GedB
You can take a look at the ASM yourself by using the /COMMENTED flag with the command line compiler. The results are well commented and legible.

If you really want to optimise to the extreme, you can hand optimise the ASM and then compile it using the /REASM flag. Satisfying: yes!. Practical: not really.

http://www.purebasic.com/documentation/ ... piler.html