Recent

Author Topic: Astronomic file size  (Read 36232 times)

GordC

  • New member
  • *
  • Posts: 8
Astronomic file size
« on: December 02, 2010, 08:57:52 pm »
I'm disappointed to bring up the subject of very large executable file size. I ported a Delphi3 program into Lazarus and found that the executable file size was 19.6Mb. The original Delphi executable was only 217Kb. Both programs have the same code and form which makes the comparison fair but how on earth do we explain this difference in size?
It doesn't look good for a developer who, trying to make the next big thing (pun not intended!), has to offer a bloated product.

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1947
Re: Astronomic file size
« Reply #1 on: December 02, 2010, 09:01:43 pm »
Please read the FAQ. Question number 1.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12430
  • Debugger - SynEdit - and more
    • wiki
Re: Astronomic file size
« Reply #2 on: December 02, 2010, 09:04:24 pm »
Sorry can't help it, but there will be some irony in my answer.... let's just say it's not your fault, let's just blame it on the many many many other people who asked the exact same question before.

In fact it had been so many of them, that the answer is the very very very first entry in the FAQ.

link is on the left of the forum

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Astronomic file size
« Reply #3 on: December 02, 2010, 09:37:10 pm »
"Astronomic" is a new word on the subject, let's see which will be the next one.

However, if you want to increase the file size, let us know.
« Last Edit: December 02, 2010, 10:00:13 pm by typo »

GordC

  • New member
  • *
  • Posts: 8
Re: Astronomic file size
« Reply #4 on: December 02, 2010, 10:23:49 pm »
Valuable advice - thanks.
Here are the results of applying the strip and compression actions.
Original 19.6MB ->strip--strip-all <file> 3.7MB, ->upx-ucl <file> 1.2MB.
 Program runs perfectly
Gord

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12905
  • FPC developer.
Re: Astronomic file size
« Reply #5 on: December 02, 2010, 11:39:21 pm »
Valuable advice - thanks.
Here are the results of applying the strip and compression actions.
Original 19.6MB ->strip--strip-all <file> 3.7MB, ->upx-ucl <file> 1.2MB.
 Program runs perfectly

Note that UPX is not necessarily recommendable, since it wastes memory, which is still way more expensive than disc.

GordC

  • New member
  • *
  • Posts: 8
Re: Astronomic file size
« Reply #6 on: December 03, 2010, 01:58:00 am »

Quote
Note that that UPX is not necessarily recommendable, since it wastes memory, which is still way more expensive than disc.

I take that to mean that upon execution  the decompressed program requires extra memory (than you might think)?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Astronomic file size
« Reply #7 on: December 03, 2010, 03:54:04 am »
Have you enabled smartlinking as well? That could greatly reduced binary size (WARNING: linking time will significantly increased on *nix, but it's damn fast on Windows).

Imants

  • Full Member
  • ***
  • Posts: 198
Re: Astronomic file size
« Reply #8 on: December 03, 2010, 10:11:23 am »
If you are using Lazarus snapshots. There are new option "use external gdb debug symbols file (-Xg)". It is working fine on windows. The you don't need to use strip

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12905
  • FPC developer.
Re: Astronomic file size
« Reply #9 on: December 03, 2010, 02:15:06 pm »

Quote
Note that that UPX is not necessarily recommendable, since it wastes memory, which is still way more expensive than disc.

I take that to mean that upon execution  the decompressed program requires extra memory (than you might think)?

Yes, at least on Windows, since windows normally memory maps the application and only loads needed parts. When UPXed, this memory mapping is not possible, and thus the whole binary is always loaded. This means that e.g. for a service app that runs a tight loop, in general only that tight loop will be part of the commit charge.

In the upx case, the whole binary will be part of the commit charge.

TurboRascal

  • Hero Member
  • *****
  • Posts: 672
  • "Good sysadmin. Bad programmer."™
Re: Astronomic file size
« Reply #10 on: December 03, 2010, 09:04:49 pm »
I agree with marcov. UPX interferes with normal Virtual Memory Manager operation, forces the executable to completely load into memory, therefore introduces delay when starting, and uses more memory as described.

I don't believe anyone needs UPX for normal applications today, not with modern disk sizes and broadband networks. It should be limited to embedded and other limited resource systems.

To decrease file sizes you should concentrate on smartlinking and getting rid of debug information...
Regards, ArNy the Turbo Rascal
-
"The secret is to give them what they need, not what they want." - Scotty, STTNG:Relics

mas steindorff

  • Hero Member
  • *****
  • Posts: 594
Re: Astronomic file size
« Reply #11 on: December 04, 2010, 12:06:20 am »
I don't believe anyone needs UPX for normal applications today, not with modern disk sizes and broadband networks.
I mostly agree but please keep in mind that some very smart folks live in the boonies like Montana, Wyoming ....  Don't fall into the "everyone has HS Internet" trap and limit your "customer" base.
I have customers in Hawaii still running on early 586 because the (other) software cost and ability prevents them from upgrading. 
These issues should not be used to hold back the Lazarus development.
windows 10 &11, Ubuntu 21+ IDE 3.4 general releases

LazaruX

  • Hero Member
  • *****
  • Posts: 597
  • Lazarus original cheetah.The cheetah doesn't cheat
Re: Astronomic file size
« Reply #12 on: December 04, 2010, 04:18:23 pm »
Let's put it like this: we have it bigger than the others ;-) ......the executable i mean ;-)

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Astronomic file size
« Reply #13 on: December 04, 2010, 04:48:21 pm »
Quote
Let's put it like this: we have it bigger than the others ;-) ......the executable i mean ;-)
For small applications, yes. But not for the big one ;)
Lazarus binary is smaller than any other IDE of almost the same level of complexity (CodeBlocks, MS Visual Studio, Anjuta, NetBeans, Eclipse, etc.). Don't just count the IDE .exe for those IDEs, since they depend on A LOT of dlls.

thierrybo

  • Full Member
  • ***
  • Posts: 146
Re: Astronomic file size
« Reply #14 on: December 05, 2010, 07:01:25 pm »
Here are the tests I did 8 months ago on Lazarus 0.9.29 for my personal use with new Lazarus 0.9.28.2.

                             Default Lazarus         LCL without debug informations
Ubuntu 64 bits / Lazarus 64 bits
Default application         13,4  Mb         7,5 Mb
Optimized compiler         4,4 Mb         2,70 Mb
   
Ubuntu 32 bits / Lazarus 32 bits
Default application         19,6  Mb          5,7 Mb
Optimized compiler         2,9 Mb         1,6 Mb
   
Windows XP 32 bits / Lazarus 32 bits
Default application         11,8 Mb         2,14 Mb
Optimized compiler         1,62 Mb         1,50 Mb
   
Windows Seven 64 bits / Lazarus 64 bits
Default application         12,3  Mb         3,20 Mb
Optimized compiler         2,14 Mb         2,16 Mb
Reply

 

TinyPortal © 2005-2018