Recent

Author Topic: Astronomic file size  (Read 36231 times)

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Astronomic file size
« Reply #30 on: February 03, 2011, 03:35:41 am »
Quote
How exactly are the LCL compiler options set? Is it done by entering command options in the Compile Lazarus dialog or is there something else?
Yes, it's set via checkboxes and comboboxes (or "other" page for non gui-available options) in compiler options dialog.

TurboRascal

  • Hero Member
  • *****
  • Posts: 672
  • "Good sysadmin. Bad programmer."™
Re: Astronomic file size
« Reply #31 on: February 03, 2011, 10:47:25 am »
Yes, it's set via checkboxes and comboboxes (or "other" page for non gui-available options) in compiler options dialog.

Checkboxes do exist in the compiler options, but it's for the current project, not for the LCL... In the "Build Lazarus" dialog there are no such settings, only the editfield to enter CLI options for the compiler. There is actually a place where the checkboxes do exist for LCL, when working with the Packages, but LCL's compiler options cannot be changed/saved. Which I don't like, because the default settings there are no Smartlinkable Units, no Smartlinking and low optimization levels...
Regards, ArNy the Turbo Rascal
-
"The secret is to give them what they need, not what they want." - Scotty, STTNG:Relics

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Astronomic file size
« Reply #32 on: February 03, 2011, 08:52:22 pm »
Sorry, I misunderstood your question.
Well then, just type in the box: -CX -XXs -O3 (and -OpPENTIUMM -CfSSE3 if your computer supports)

TurboRascal

  • Hero Member
  • *****
  • Posts: 672
  • "Good sysadmin. Bad programmer."™
Re: Astronomic file size
« Reply #33 on: February 05, 2011, 01:39:05 am »
Sorry, I misunderstood your question.
Well then, just type in the box: -CX -XXs -O3 (and -OpPENTIUMM -CfSSE3 if your computer supports)
Yes, I've already used -CX -XX -O2, I might also try those CPU related parameters for better performance. However, by default the IDE project obviously include -gl (line numbers), and although I can _add_ parameters, I'd also like to be able to compile _without_ that particular option, this way I get the IDE compiled binary of 140MB... How can I remove that option from IDE (and possibly LCL) compilation?

Also, I don't see any difference when I add the above mentioned smartlinking parameters; and there is no change in the compiled binary size when I turn on or off those parameters in Project/Compiler options in projects I do. What gives?  %)
« Last Edit: February 05, 2011, 01:42:34 am by TurboRascal »
Regards, ArNy the Turbo Rascal
-
"The secret is to give them what they need, not what they want." - Scotty, STTNG:Relics

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Astronomic file size
« Reply #34 on: February 05, 2011, 06:24:54 pm »
Quote
Also, I don't see any difference when I add the above mentioned smartlinking parameters; and there is no change in the compiled binary size when I turn on or off those parameters in Project/Compiler options in projects I do. What gives?
So it's still not yet fixed. The Makefile that Lazarus use to rebuild itself contains -gl -O2 by default, setting those options I mentioned seems to conflict or what. I made a small program to replace all -gl -O2 to those option and it works. Anyway, before trying what I've done, try adding -g- (it should remove debug info). Lazarus binary with standard components without debug info should be around 10 MB only.

TurboRascal

  • Hero Member
  • *****
  • Posts: 672
  • "Good sysadmin. Bad programmer."™
Re: Astronomic file size
« Reply #35 on: February 06, 2011, 04:02:48 pm »
The Makefile that Lazarus use to rebuild itself contains -gl -O2 by default, setting those options I mentioned seems to conflict or what. I made a small program to replace all -gl -O2 to those option and it works. Anyway, before trying what I've done, try adding -g- (it should remove debug info). Lazarus binary with standard components without debug info should be around 10 MB only.

Thanks for the tip! Adding -g- to the options obviously disabled -gl, now my lazarus binary is back to 12MB ;)

I still don't get what's wrong with smartlinking; when I compile my projects with smartlinking enabled in the Project/Compiler Options, the size of the binary is the same as with it disabled!

I've tried a little test, dropping just one component from each unit to the form, something which should show severe differences in sizes with smartlinking (pulling in the whole unit vs. just the component code). The same test in Delphi works as expected - the resulting binary is just a few hundreds kB max. In Lazarus, the result is in megabytes and with no difference if I turn smartlinking off or on...  %)
Regards, ArNy the Turbo Rascal
-
"The secret is to give them what they need, not what they want." - Scotty, STTNG:Relics

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Astronomic file size
« Reply #36 on: February 06, 2011, 04:39:09 pm »
Quote
I still don't get what's wrong with smartlinking; when I compile my projects with smartlinking enabled in the Project/Compiler Options, the size of the binary is the same as with it disabled!
It depends how you use it, if the smartlinker can prove that a symbol (variable or function) is never used, then it will be removed.
Quote
I've tried a little test, dropping just one component from each unit to the form, something which should show severe differences in sizes with smartlinking (pulling in the whole unit vs. just the component code). The same test in Delphi works as expected - the resulting binary is just a few hundreds kB max. In Lazarus, the result is in megabytes and with no difference if I turn smartlinking off or on...
Components usually have initialization part in the containing unit, that's what prevents smartlinker from stripping it out. Try with your own unit.
« Last Edit: February 07, 2011, 03:09:33 am by Leledumbo »

TurboRascal

  • Hero Member
  • *****
  • Posts: 672
  • "Good sysadmin. Bad programmer."™
Re: Astronomic file size
« Reply #37 on: February 06, 2011, 06:18:09 pm »
It depends how you use it, if the smartlinker can prove that a symbol (variable or function) is never used, then it will be removed.
...
Components usually have initialization part in the containing unit, that's what prevents smartlinker from stripping it out. Try with your own unit.

So I guess it means simply that smartlinking algorithm isn't so 'smart' yet...? Delphi's linking mechanism obviously still works much better... :(

But, I still believe SOME change should be visible... NO change in size when smartlinking is enabled is quite an unexpected behaviour...
Regards, ArNy the Turbo Rascal
-
"The secret is to give them what they need, not what they want." - Scotty, STTNG:Relics

José Mejuto

  • Full Member
  • ***
  • Posts: 136
Re: Astronomic file size
« Reply #38 on: February 06, 2011, 07:29:19 pm »
But, I still believe SOME change should be visible... NO change in size when smartlinking is enabled is quite an unexpected behaviour...

Hello,

AFAIK SmartLinking in Windows is a must, so not really an option. Even if you disable the option it will be performed at least using the internal linker.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Astronomic file size
« Reply #39 on: February 07, 2011, 03:18:20 am »
Quote
So I guess it means simply that smartlinking algorithm isn't so 'smart' yet...? Delphi's linking mechanism obviously still works much better...
No, it's already done a correct and good job. Remember that FPC's RTL+FCL+LCL and Delphi's VCL have different library structure due to the platform and widgetset independent layer. Plus, many functions are linked by a standard LCL application (XML handling for instance) because it's used internally by some components.
Quote
But, I still believe SOME change should be visible... NO change in size when smartlinking is enabled is quite an unexpected behaviour...
Not really, as I said before, it depends how the symbols are used. The smartlinker *and you* should be able to prove that a symbol is totally unreachable before removing the symbol. If the symbol isn't removed, that means it's used, either directly (by your program) or indirectly (by other functions that you use). If you want to see the prove, try compiling with WPO enabled. The generated WPO file shows used symbols in your application, both directly and indirectly. Anyway, WPO could also improve binary size.

 

TinyPortal © 2005-2018