Recent

Author Topic: EXEcutable sizes  (Read 22510 times)

6ar453v3n

  • New member
  • *
  • Posts: 8
EXEcutable sizes
« on: July 03, 2014, 08:53:55 pm »

If I write a "hello world" program for DOS, about how
many bytes would the executable be?

67

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: EXEcutable sizes
« Reply #1 on: July 03, 2014, 09:12:32 pm »
The simplest console program has 170kB here. It is without debug info. Maybe some compiler switches can reduce size even more.

EDIT: Compiled with -XXs has 25kB. strip probably didn't work properly.
« Last Edit: July 03, 2014, 09:22:11 pm by Blaazen »
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: EXEcutable sizes
« Reply #2 on: July 03, 2014, 10:17:54 pm »
Afaik the 16-bit compiler (in trunk) generates smaller programs. A .com (compact model) of the console tetris game is 44k iirc. Hello world programs don't mean much. Pick a program that does something in the same magnitude as what you want.

But nowadays sizes is barely important, except for contests.
« Last Edit: July 03, 2014, 10:41:35 pm by marcov »

6ar453v3n

  • New member
  • *
  • Posts: 8
Re: EXEcutable sizes
« Reply #3 on: July 03, 2014, 10:26:24 pm »
Size is not important?

OK if the LINUX kernel were written in FP what would happen?

SB

bigeno

  • Sr. Member
  • ****
  • Posts: 266
Re: EXEcutable sizes
« Reply #4 on: July 03, 2014, 10:34:00 pm »
Size is not important?

OK if the LINUX kernel were written in FP what would happen?
You talk about simple program for linux,dos,windows or asm for Linux kernel ?

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: EXEcutable sizes
« Reply #5 on: July 03, 2014, 10:37:43 pm »
Size is not important?

OK if the LINUX kernel were written in FP what would happen?

If mini benchmarks would mean anything, if we must belive the great language shootout benchmarks, it would do with 1/25th of the memory.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: EXEcutable sizes
« Reply #6 on: July 03, 2014, 10:39:24 pm »
Size is not important?

OK if the LINUX kernel were written in FP what would happen?
The size of hello world is caused by a larger RTL.

However, RTL can be customized, decreasing the size

Speaking of Linux Kernels
2Mbs is the minimum custom build... a bit larger than 56K.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: EXEcutable sizes
« Reply #7 on: July 03, 2014, 10:41:16 pm »
If mini benchmarks would mean anything, if we must belive the great language shootout benchmarks, it would do with 1/25th of the memory.
My favourite article about the subject.  :D

It was inspiring me to create a "superstrip" tool, luckly I have more useful things to do.

6ar453v3n

  • New member
  • *
  • Posts: 8
Re: EXEcutable sizes
« Reply #8 on: July 03, 2014, 10:55:10 pm »
Postby 6ar453v3n » Jul 03, 2014 13:50

There is (used to be) a separate dead code eliminator program for TP302 and TP55 that worked quite well. Hello World ended up being about 3kb. I don't thing anyone has to spend time on redesign but a dead code eliminator and re-linker for FP would be very useful.

SB

bigeno

  • Sr. Member
  • ****
  • Posts: 266
Re: EXEcutable sizes
« Reply #9 on: July 03, 2014, 11:25:35 pm »
AFAIK fpc have dead code elimination, compiler/optdead.pas

6ar453v3n

  • New member
  • *
  • Posts: 8
Re: EXEcutable sizes
« Reply #10 on: July 04, 2014, 05:13:14 am »

The size of hello world is caused by a larger RTL.

However, RTL can be customized, decreasing the size

=====

Are you saying all of the RTL is being executed.
I doubt it.

I am talking about removing unexecuted code at each entry point.
Not an executable line of code that gets jumped over.

If you google "removing dead code" you will find a lot of information.

And the article on tint PE code is excellent.

=====

A question: I have 5 TEE programs ranging from 57kb to 5kb.
All do the same thing. Which EXE should I put on my disk?

SB


skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: EXEcutable sizes
« Reply #11 on: July 04, 2014, 06:03:58 am »
A question: I have 5 TEE programs ranging from 57kb to 5kb.
All do the same thing. Which EXE should I put on my disk?
This is a strange question. You already have all 5 programs on your disk :)
but you should definitely keep 5kb program.

and, btw, give upx a try! it might reduce the hello world from 57 down to 30-15kb, who knows, maybe even less.

Speaking about removing "dead code". Compiler patches are welcomed!
« Last Edit: July 04, 2014, 06:07:32 am by skalogryz »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: EXEcutable sizes
« Reply #12 on: July 04, 2014, 06:34:59 am »
The size of hello world is caused by a larger RTL.

Not entirely, e.g. 32-bit code is bulkier

Quote
However, RTL can be customized, decreasing the size

If you just want to kill time on with futile endeavours, yes. And then you stuff the result on a 2TB harddisk occupying 0.000005%  (I hope I got the number of zeros correct).

EXE size is mostly irrelevant: read http://wiki.freepascal.org/Size_Matters

Quote
Are you saying all of the RTL is being executed.
I doubt it.

No we are not saying that. Some might be because something in the RTL can be plugged in, support for soft-float,exceptions, translation, timezones, readable runtime messages and localization is often not automatically removed. Dead code elimination can not kill everything. The few embedded people that care manually maintain their own minimal RTL anyway

What we are saying is that we value functionality over size, or at least in the low end of the size scale.

Quote
A question: I have 5 TEE programs ranging from 57kb to 5kb.
All do the same thing. Which EXE should I put on my disk?

The one that works best. Size is not a factor
« Last Edit: July 04, 2014, 06:42:32 am by marcov »

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: EXEcutable sizes
« Reply #13 on: July 04, 2014, 06:39:10 am »
The one that works best. Size is not a factor
It's just one of these endless discussions. Similar to improving FPC compile time :)

6ar453v3n, I'd suggest you to search from maillist archive (fpc-pascal. fpc-devel) and the forum for similar threads.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: EXEcutable sizes
« Reply #14 on: July 04, 2014, 06:41:59 am »
The one that works best. Size is not a factor
It's just one of these endless discussions. Similar to improving FPC compile time :)

Which is why there is the size matters FAQ. My bad, that should have been in the first post.  And I thought the 16-bit port was one good argument to end this once and for all :-) A size concerned person that DOESN'T use 16-bit ?:-)

A similar post appeared on the freebasic forums btw.
« Last Edit: July 04, 2014, 06:45:26 am by marcov »

 

TinyPortal © 2005-2018