Forum > Windows

How to reduce EXE program size?

<< < (2/16) > >>

FlierMate:

--- Quote from: winni on April 11, 2021, 02:35:37 pm ---Hi!

Assuming you got only 4GB Ram then your exe occupies 0.001 % of it.

Winni

--- End quote ---

That is a different perspective to look at it.  Certainly it makes me less worried about the size of EXE.  :P


--- Quote from: marcov on April 11, 2021, 02:43:59 pm ---So the short answer is: maintain a custom rtl is the easiest for special size requirements. Of course work on improving the smart linking is always welcome.

--- End quote ---

FPC is a large project, it would take tremendous effort and time to study the code, let alone working on improving the linker. What I initially thought is a quick fix, but as I said, it is more complicated than that.
And thanks for the answer.



--- Quote from: Gustavo 'Gus' Carreno on April 11, 2021, 02:52:00 pm ---So, FlierMate, could you please explain to me this urgent quest to make the binary small? Please?

I profoundly thank you, in advance, for any light shed into this predicament.

--- End quote ---

I was used to participate in so called "size-optimizing coding contest", so I, for one, is quite obsessed about file size of binary executable.  People are always go for "smaller and faster" or "bigger and faster"(size, depending on the circumstance), or you have heard enough of "shortest path to a solution". All in all, clean code and small binary footprint are often correlated to efficiency.  Hopefully I have answered your question.   :-[

FlierMate:

--- Quote from: Aidex on April 11, 2021, 03:31:24 pm ---Hi!
Have you tried the following?

Project Settings > Compiler Settings > Debugging > tick "Use external debug symbols file"

--- End quote ---

Hi there.  I think you are talking about Lazarus IDE? Hmm..

marcov:

--- Quote from: FlierMate on April 11, 2021, 03:38:37 pm ---FPC is a large project, it would take tremendous effort and time to study the code, let alone working on improving the linker. What I initially thought is a quick fix, but as I said, it is more complicated than that.

--- End quote ---

That's the quick fix. Commenting some initializations in various standard units and maintain that as a custom RTL. Think about things like localisation, timezone support, thread support etc. Slightly harder is returning the string support back to the pre unicode level.

Note that embedded targets of FPC already do some of this. If you need embedded windows, you need to enable/backport such tricks to win32

Most low hanging has mostly been done.

Aidex:
FlierMate, the compiler option I meant is -Xg

GetMem:
Quick test: FPC 3.2.0 vs. CodeBlocks 20.3, 32 bit "Hello world" application, both in release mode:
1. FPC 3.2.0:  33,280 bytes
2. CodeBlocks: 18,944 bytes

Where is the big difference?  Yes, the binary generated by FPC is slightly larger, but I don't think this is problem, not for me at least. :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version