Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros entornos y lenguajes > Lazarus, FreePascal, Kylix, etc.
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 05-04-2012
Avatar de Casimiro Notevi
Casimiro Notevi Casimiro Notevi is offline
Moderador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.079
Poder: 10
Casimiro Notevi Tiene un aura espectacularCasimiro Notevi Tiene un aura espectacular
Sobre el tamaño de los ejecutables:

Cita:
Empezado por lazarus
Why are the generated binaries so big?

The binaries are big because they include a lot of debug information necessary for using gdb (GNU Debugger).
The compiler has an option to remove the debug information from the executable (-Xs), but due to a bug in the compiler (version 2.0.2 and earlier), this doesn't work correctly. It has been fixed in version 2.0.4 and later of the compiler.
You can use a program called "strip" to remove the debug symbols from the executable file. It is located under lazarus dir lazarus\fpc\2.4.2\bin\i386-win32\.
Just type "strip --strip-all <your executable file with path>" on the command line.
If you want to make your program even smaller, you should try UPX too. UPX is a very good exe compressor. It includes no memory overhead due to in-place decompression. It also has a very fast decompression (~10 MB/sec on an Pentium 133).
To use upx just type "upx <your executable file with path>" on the command line.
after using both strip and upx a simple GUI Lazarus program gets:
  • ~ 700kb on Linux
  • ~ 420kb on Windows
A more detailed answer with the drawbacks of using UPX is given on Size Matters.
It's also important to note that the hello world lazarus software already includes a huge amount of features. It includes:
  • XML handling library
  • Image handling library for png, xpm, bmp and ico files
  • Almost all widgets from the Lazarus Component Library
  • All of the Free Pascal Runtime Library
So it's very big, but it already includes almost everything a real world non-trivial app will need.
Lazarus executable size starts big, but grows very slowly, because of the Free Pascal compiler and the way lazarus forms operate. A c++ project (just an example, but applies to other languages / tools too) starts very small on the hello world, but quickly grows exponentially when you need features to write a non-trivial application.

Quick guide to Lazarus/FPC application size reduction (tested with Lazarus 0.9.26)
  • 1. Project|Compiler Options|Code|Smart Linkable (-CX) -> Checked
  • 2. Project|Compiler Options|Linking|Debugging| Uncheck all except
Strip Symbols From Executable (-Xs) -> Checked
  • 3. Project|Compiler Options|Linking|Link Style|Link Smart (-XX) -> Checked
The most important items seem to be 2. For a simple application the executable size should now be 1-3 MB instead of 15-20 MB. At this point you can also try: Project|Compiler Options|Code|Optimizations|smaller rather than faster -> Checked (Warning: this might decrease performance)
  • 4. (Optional) Run UPX <your_executable> to compress your binary by an additional factor of 2-3 (Warning: as indicated above, there are drawbacks to using UPX).
Chart of default sizes for an empty Application with various settings and operating systems
Well I ran tests I did on Lazarus 0.9.29 with FPC 2.4 (FPC 2.2.4 with Windows). Optimized compiler mean using the advices above but without using UPX. Default Lazarus means as installed from package/setup. LCL without debug informations mean after rebuilding Lazarus IDE and LCL without debug informations (-g-).

Default Lazarus LCL without debug informations Ubuntu 64 bits / Lazarus 64 bits
Default application 13,4 Mb 7,5 Mb / 8 Optimized compiler 4,4 Mb 2,70 Mb (0.29svn FPC2.4 2,5)
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
Responder Con Cita
  #2  
Antiguo 07-04-2012
Avatar de mightydragonlor
[mightydragonlor] mightydragonlor is offline
Miembro Premium
 
Registrado: feb 2007
Ubicación: Medellín-Colombia
Posts: 587
Poder: 18
mightydragonlor Va por buen camino
Gracias por el dato Casimiro, si bien es verdad que Delphi produce exe's pequeños, pos así Lazarus los produzca grandes, no les veo mayor importancia, ya que se puede reducir =)
__________________
mas confundido que Garavito el día del Niño.
Responder Con Cita
  #3  
Antiguo 09-04-2012
santi33a santi33a is offline
Miembro
 
Registrado: jun 2005
Posts: 208
Poder: 20
santi33a Va por buen camino
Cita:
Quick guide to Lazarus/FPC application size reduction (tested with Lazarus 0.9.26)
1. Project|Compiler Options|Code|Smart Linkable (-CX) -> Checked
2. Project|Compiler Options|Linking|Debugging| Uncheck all except
Strip Symbols From Executable (-Xs) -> Checked
3. Project|Compiler Options|Linking|Link Style|Link Smart (-XX) -> Checked
The most important items seem to be 2. For a simple application the executable size should now be 1-3 MB instead of 15-20 MB. At this point you can also try: Project|Compiler Options|Code|Optimizations|smaller rather than faster -> Checked (Warning: this might decrease performance)
Seguí todas estas instrucciones y nada, no logré que bajara el tamaño del ejecutable

Cita:
4. (Optional) Run UPX <your_executable> to compress your binary by an additional factor of 2-3 (Warning: as indicated above, there are drawbacks to using UPX).
No me parece valida esta opción, no es lo mismo comprimir el código a que me genere un código mas eficiente es decir que haga lo mismo con menos instrucciones. con el UPX cualquiera baja su tamaño ya sea en delphi como en lazarus.
Responder Con Cita
  #4  
Antiguo 09-04-2012
Avatar de Casimiro Notevi
Casimiro Notevi Casimiro Notevi is offline
Moderador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.079
Poder: 10
Casimiro Notevi Tiene un aura espectacularCasimiro Notevi Tiene un aura espectacular
Cita:
Empezado por santi33a Ver Mensaje
No me parece valida esta opción, no es lo mismo comprimir el código a que me genere un código mas eficiente es decir que haga lo mismo con menos instrucciones. con el UPX cualquiera baja su tamaño ya sea en delphi como en lazarus.
Que el ejecutable sea más o menos grande no quiere decir que sea más o menos eficiente.
El ejecutable generado en lazarus es más grande, como ya se ha indicado, porque incluye mucha más (o de distinta forma) información para depuración que el que necesita delphi con su compilador, que están hechos el uno para el otro, sin embargo, lazarus usa un deparador externo (de terceros) que sirve para otros lenguajes.

Lo de comprimir con upx, desde luego, ahí tienes razón.
Responder Con Cita
  #5  
Antiguo 27-04-2012
alsn alsn is offline
Miembro
NULL
 
Registrado: abr 2012
Posts: 20
Poder: 0
alsn Va por buen camino
Hola, yo solo marco:
-Visualizar números de líneas en los errores de tiempo de ejecución en trazados inversos (-gl)
-Usar archivo externo de simbolos de depuración para gdb (-Xg)

Con esto, para un formulario en blanco, pasa de 13.384 KB a 1.608 KB, sin perder la depuración.

Un saludo
Responder Con Cita
  #6  
Antiguo 27-04-2012
Avatar de Casimiro Notevi
Casimiro Notevi Casimiro Notevi is offline
Moderador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.079
Poder: 10
Casimiro Notevi Tiene un aura espectacularCasimiro Notevi Tiene un aura espectacular
Gracias por tu aportación.
Y bienvenido a clubdelphi
Responder Con Cita
  #7  
Antiguo 28-04-2012
alsn alsn is offline
Miembro
NULL
 
Registrado: abr 2012
Posts: 20
Poder: 0
alsn Va por buen camino
Muchas gracias a vosotros. Aunque sin registrarme, he visitado mucho esta página, y me ha sido de gran utilidad.
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Delphi o lazarus a PHP en un solo paso donald shimoda Noticias 4 10-09-2008 20:22:22
Delphi A Lazarus rcm861 Noticias 6 10-09-2008 15:31:25
de turbo delphi a Lazarus totote Lazarus, FreePascal, Kylix, etc. 3 12-06-2007 07:15:21
instalar lazarus y delphi nightynvid Lazarus, FreePascal, Kylix, etc. 2 13-11-2006 19:08:04
[Lazarus] GTK+-devel en SUSE. problema instalar lazarus de esa libreria. sakuragi Lazarus, FreePascal, Kylix, etc. 3 28-09-2006 03:31:09


La franja horaria es GMT +2. Ahora son las 18:06:34.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi