general rules to get smaller (tiny) executables ?

Everything else that doesn't fall into one of the other PB categories.
newbie
Enthusiast
Enthusiast
Posts: 296
Joined: Tue Jul 29, 2003 5:47 pm
Location: FRANCE
Contact:

general rules to get smaller (tiny) executables ?

Post 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 ;)
- Registered PB user -

Using PB 4.00
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Do not use any windows or gadgets :)
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

And only use the API. But it's much easy to code with PB commands, and executables are still small, IMHO.
El_Choni
newbie
Enthusiast
Enthusiast
Posts: 296
Joined: Tue Jul 29, 2003 5:47 pm
Location: FRANCE
Contact:

Post 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 ;)
- Registered PB user -

Using PB 4.00
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

..

Post 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
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post 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
Post Reply