Recent

Author Topic: Size of executables  (Read 18580 times)

triple-r

  • Guest
Size of executables
« on: January 27, 2011, 06:57:53 pm »
Hi everybody,
I'm somewhat new in using Lazarus. For several years my favorite development system was Delphi6 - and it always fits my needs. But now I have to deal with complete unicode based apps, what Delphi6 does not support with the standard VCL components. So I tried to use Lazarus instead. Everything works fine - and I was enthusiastic while trying it out! But then I was really shocked when I recognized that a simple Win32 app with only an empty window (without any additional components) was compiled to an executable of more than 12 MB in size. The same poor Delphi6 executable is of some 10% of this size. Is there anything with the compiler or linker I should configure better or is there always a kind of a "runtime engine" linked into the app? Every hint from you as experienced Lazarus experts is highly appreciated.



triple-r

  • Guest
Re: Size of executables
« Reply #3 on: January 27, 2011, 07:47:05 pm »
Wow, thanks a lot for your help. I also thougt about debug infos, but I couldn't find any config information to exclude debug infos from the binary. But with your hint it works! With the "strip command" the size of the test app reduces from 12 MB to 1.6 MB.

Only, opposite of the FAQ (<quote>"You can use a program called "strip" to remove the debug symbols from the executable file. It is located under lazarus dir lazarus\pp\bin\i386-win32\. </quote>)

in my case the "strip.exe" was located under lazarus\fpc\2.2.4\bin\i386-win32\. But at last - the problem is solved. So the Lazarus community got a new fan now using this great development sytem from now on.
Ray

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: Size of executables
« Reply #4 on: January 27, 2011, 07:48:32 pm »
I can add here an example from real life.

My (still unfinished) project (Lazarus + Qt):

more than 31000 lines (more than 1000 methods)
more than 1000 components (incl. TMenuItems and TActions) on 7 Forms

Compiled: 18.6 MB
Stripped: 6.9 MB
(I use only external program "strip" for it, I don't use any smartlinking and compiler options because my applicateion is still under development. I will do it when finished.)
I tried archives (tar, gunzip and zip give 1.8 MB; 7z gives 1.2MB). UPX is not recommended.

Archived size is OK when you want distribute on Internet.
(BTW I tried IcoFX  (Delphi app. for drawing icons) under Wine and its setup.exe is 1.5 MB. Unpacked (installed) directory is 3.7 MB.)

You can see that filesize is not big problem especially for big application. Start size is bigger but grows slowly in my opinion.



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/

Scoops

  • Full Member
  • ***
  • Posts: 100
Re: Size of executables
« Reply #5 on: January 27, 2011, 07:50:40 pm »
Hi,

Try From the main menu:

'Project > Project Options > Compiler Options > Linking'

If Checked - Uncheck - 'Display Line Numbers In Run-time Error Backtraces'

After that use upx to compress the application

Hope it helps

Bye

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Size of executables
« Reply #6 on: January 27, 2011, 07:55:38 pm »
File size seems to be a big problem for beginners, but it is not.

triple-r

  • Guest
Re: Size of executables
« Reply #7 on: January 27, 2011, 08:07:01 pm »
Hi Blaazen,
<quote>"Start size is bigger but grows slowly in my opinion."</quote>

you're right. As I converted my recent (big) Delphi project to Lazarus the binary size increases from the 12 MB (empty Window as starting point) to just 16 MB, although I added a thousand lines of code and a lot of visual components. So I can confirm that the size grows very slowly from the starting point.

triple-r

  • Guest
Re: Size of executables
« Reply #8 on: January 27, 2011, 08:18:57 pm »
@ typo:
"File size seems to be a big problem for beginners, but it is not."

For distributing executables from servers the file size is simply a traffic problem on the net. But with the "strip" command the problem is already solved. It's not a question of real "beginners" but a question of beginners in trying out another development system without having a complete user documentation. Just learning by doing...

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Size of executables
« Reply #9 on: January 27, 2011, 08:20:47 pm »
@ typo:
"File size seems to be a big problem for beginners, but it is not."

For distributing executables from servers the file size is simply a traffic problem on the net. But with the "strip" command the problem is already solved. It's not a question of real "beginners" but a question of beginners in trying out another development system without having a complete user documentation. Just learning by doing...

These are the typical excuses people try to find to justify an emotional shock when seeing a binary that is bigger than the one from a ten years old tool. Try to step over this, and only mention such thing when you really established it is a problem.

In reality, debug information is very compressable, and most http2 traffic is zlib compressed afaik, and obtaining quality tracebacks are more important than a bit of traffic (and it is indeed only a bit, compressed)
« Last Edit: January 27, 2011, 08:23:04 pm by marcov »

xenblaise

  • Sr. Member
  • ****
  • Posts: 358
Re: Size of executables
« Reply #10 on: January 27, 2011, 08:32:05 pm »
strip --strip-all project1.exe
upx project1.exe

Size of executable is like Delphi now :D and is faster than Delphi 8-)

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Size of executables
« Reply #11 on: January 27, 2011, 08:41:24 pm »
Indeed, if was not so fun to see what beginners say about the file size...

triple-r

  • Guest
Re: Size of executables
« Reply #12 on: January 27, 2011, 09:00:41 pm »
@marcov:
"These are the typical excuses people try to find to justify an emotional shock when seeing a binary that is bigger than the one from a ten years old tool."

I do not want to excuse anything. I've got a question - I've got an helpul answer. That's all.

@typo:
Indeed, if was not so fun to see what beginners say about the file size...
Please feel free to provide your further remarks. But thanks again for yor previous help. 

garlar27

  • Hero Member
  • *****
  • Posts: 652
Re: Size of executables
« Reply #13 on: January 27, 2011, 09:05:54 pm »
I think it's because beginners are used to smaller executables because in other languages the real binary size is hidden inside Libraries (like visual basic does) or by the interpreter or by Virtual Machines.

Then comes the surprise and the  ... complains.

triple-r

  • Guest
Re: Size of executables
« Reply #14 on: January 27, 2011, 09:13:26 pm »
Sorry, garlar27, but not in this case. But I'm logging out now. Bye, everybody...

 

TinyPortal © 2005-2018