Recent

Author Topic: How to reduce EXE program size?  (Read 23018 times)

FlierMate

  • Guest
Re: How to reduce EXE program size?
« Reply #30 on: April 11, 2021, 06:04:13 pm »
Below are some more findings. All are the size of console apps which have dependency.

C# .NET - 4,608 bytes EXE.
Generate .NET Framework dependent executable.
Code: [Select]
using System;

namespace N
{
   class Program
   {
       static void Main(string[] args)
       {
           Console.Write("Hello World");
       }
   }
}

Visual C++ - 10,752 bytes EXE.
Generate CRT-dependent executable?

Code: [Select]
#include <iostream>

int main()
{
   std::cout << "Hello World\n";
}

Fred vS

  • Hero Member
  • *****
  • Posts: 2544
    • StrumPract is the musicians best friend
Re: How to reduce EXE program size?
« Reply #31 on: April 11, 2021, 06:13:50 pm »
@ FlierMate

Yes, we know, fpc generates bigger exe than his comparable Visual C++ friend.

And, like marcov explained, it is due to the initialization of some units used by the RTL.

If you want to jump into it and make a "light RTL", I am very interested by your work.

Fre;D
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs

y.ivanov

  • Sr. Member
  • ****
  • Posts: 338
Re: How to reduce EXE program size?
« Reply #32 on: April 11, 2021, 06:17:44 pm »
Hello y.ivanov.

I think that it is the same for everybody starting with fpc (included me, of course).

The size of the executable that is bigger than with their comparable compilers concurrents.

This question come back each year, like a wave, but the good news is that in practice, each new fpc release produces smaller exe.

And yes, fpc produces bigger exe than his concurrents, but fpc does not have any competitor for cross-compilations, for his huge numbers of targets, his human-pascal-language, his hot forum with mad people and much more.

Amen.

Fre;D

Thanx, Fred!
For reminding me that
Quote
... his hot forum with mad people and much more.
is a virtue.

I know well the reasons behind the FPC exe bigger sizes. I'm OK with that. The only thing I miss is the lightning compilation speed with Delphi.  :)

Regards,
 

GetMem

  • Hero Member
  • *****
  • Posts: 3745
Re: How to reduce EXE program size?
« Reply #33 on: April 11, 2021, 06:21:21 pm »
@marcov

Yes, it's a standalone application and yes msvcrt.dll is loaded, still the fpc binary is only 1.7x bigger.

FlierMate

  • Guest
Re: How to reduce EXE program size?
« Reply #34 on: April 11, 2021, 06:23:07 pm »
If you want to jump into it and make a "light RTL", I am very interested by your work.

Yes, and thanks for the encouraging words. I started this topic when I was trying to compress the EXE compiled by FPC. I am wondering is there anyone who is working on a "light RTL" project?     

winni

  • Hero Member
  • *****
  • Posts: 3051
Re: How to reduce EXE program size?
« Reply #35 on: April 11, 2021, 06:29:20 pm »

Yes, and thanks for the encouraging words. I started this topic when I was trying to compress the EXE compiled by FPC. I am wondering is there anyone who is working on a "light RTL" project?   

As far as I know: No.

The reason is simple:
Today you can't buy a PC with "light RAM" anymore.

Winni

Fred vS

  • Hero Member
  • *****
  • Posts: 2544
    • StrumPract is the musicians best friend
Re: How to reduce EXE program size?
« Reply #36 on: April 11, 2021, 06:32:56 pm »

Yes, and thanks for the encouraging words. I started this topic when I was trying to compress the EXE compiled by FPC. I am wondering is there anyone who is working on a "light RTL" project?   

As far as I know: No.

The reason is simple:
Today you can't buy a PC with "light RAM" anymore.

Winni

There are the Rpi and micro-friends that does some effort.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs

lainz

  • Hero Member
  • *****
  • Posts: 3933
Re: How to reduce EXE program size?
« Reply #37 on: April 11, 2021, 06:36:32 pm »

Yes, and thanks for the encouraging words. I started this topic when I was trying to compress the EXE compiled by FPC. I am wondering is there anyone who is working on a "light RTL" project?   

As far as I know: No.

The reason is simple:
Today you can't buy a PC with "light RAM" anymore.

Winni

Not PC but specialized hardware like printers with Linux OS. Limited hardware for specific use cases.

But some few KB's will do nothing. I mean the hardware I mentioned can run Electron without problems as well.

Fred vS

  • Hero Member
  • *****
  • Posts: 2544
    • StrumPract is the musicians best friend
Re: How to reduce EXE program size?
« Reply #38 on: April 11, 2021, 06:45:43 pm »
But some few KB's will do nothing. I mean the hardware I mentioned can run Electron without problems as well.

Hum, for - 32 Kb (and more) for a simple console prog, I am interested by the "Light RTL" fork of FlierMate.
« Last Edit: April 11, 2021, 07:15:13 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 865
  • Professional amateur ;-P
Re: How to reduce EXE program size?
« Reply #39 on: April 11, 2021, 06:46:27 pm »
Hey all,

[snip] his hot forum with mad people and much more.

Mad person in the house. Present and accounted for ;)

Cheers,
Gus
Lazarus 2.3.0(trunk) FPC 3.3.1(trunk) Ubuntu 21.10 64b Dark Theme
Lazarus 2.0.12(stable) FPC 3.2.2(stable) Ubuntu 21.10 64b Dark Theme
http://github.com/gcarreno

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9995
  • FPC developer.
Re: How to reduce EXE program size?
« Reply #40 on: April 11, 2021, 07:21:20 pm »
But some few KB's will do nothing. I mean the hardware I mentioned can run Electron without problems as well.

Hum, for - 32 Kb (and more) for a simple console prog, 

32KB for a *windows* console prog.   If you want to compare to embedded solutions, your testing must also be for FPC embedded targets like arduino or some Arm Cortext M*.

Unless you are still nursing one of those notorious Windows NT4 based printers :-)  (and FPC doesn't support <XP anymore)
« Last Edit: April 11, 2021, 07:26:24 pm by marcov »

Fred vS

  • Hero Member
  • *****
  • Posts: 2544
    • StrumPract is the musicians best friend
Re: How to reduce EXE program size?
« Reply #41 on: April 11, 2021, 07:31:22 pm »
But some few KB's will do nothing. I mean the hardware I mentioned can run Electron without problems as well.

Hum, for - 32 Kb (and more) for a simple console prog, 

For a *windows* console prog.   If you want to compare to embedded solutions, your testing must also be for FPC embedded targets like arduino or some Arm Cortext M*.

Ooops, sorry, the topic is about Windows and his tons of RAM needed, then of course 32 KB is nothing.

No, I was not thinking about Windows but embedded solutions that have few memory, mainly using Linux.
« Last Edit: April 11, 2021, 07:44:24 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs

winni

  • Hero Member
  • *****
  • Posts: 3051
Re: How to reduce EXE program size?
« Reply #42 on: April 11, 2021, 07:48:11 pm »
Hi!

I recognized that some people don't have a feeling what a kilobyte is related to a gigabyte. For those a graphic is always helpfull.

In the attachment.

Winni

Fred vS

  • Hero Member
  • *****
  • Posts: 2544
    • StrumPract is the musicians best friend
Re: How to reduce EXE program size?
« Reply #43 on: April 11, 2021, 07:50:48 pm »
Sorry to come back with the first post, but if there something to compare on Windows, what are the result in size with fpc vs Delphi?
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs

Fred vS

  • Hero Member
  • *****
  • Posts: 2544
    • StrumPract is the musicians best friend
Re: How to reduce EXE program size?
« Reply #44 on: April 11, 2021, 08:03:10 pm »
Hi!

I recognized that some people don't have a feeling what a kilobyte is related to a gigabyte. For those a graphic is always helpfull.

In the attachment.

Winni

Here with arduino 32 Kb ram + 2 KB flash.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs

 

TinyPortal © 2005-2018