File size and smartlinking/pt

From Lazarus wiki
Jump to navigationJump to search

Template:Tamanho do executável o e smartlinking

Este artigo é um "work in progress" sobre tamanho do executável e smartlinking em Lazarus. Esteja à vontade para contribuir.

Introdução

Estudo de Caso 1 em Windows

Este estudo de caso foi realizado em 8 de fevereiro de 2006 porque uma versão com SmartLinking (0.9.12) foi publicada. Ele pretende estabelecer uma relação entre a variação dos resultados abaixo e diferentes versões do Lazarus e do compilador FreePascal, tanto quanto entre versões com e sem o SmartLinking. As variáveis estudadas são:

  • Tamanho do executável depois de usar o strip.exe
  • Tamanho do executável depois de usar o upx.exe
  • Tempo de linkagem

O tempo de compilação não é considerado aqui porque é muito similar em todas as configurações e muito menos significativo que o tempo de linkagem. O tamanho do executável sem o strip.exe não incluído. Note que o strip é usado sempre da linha de comando com:

strip --strip-all magnifier.exe

O programa sendo compilado é o Virtual Magnifying Glass. Os fontes e o arquivo binário estão disponíiveis para download em http://magnifier.sourceforge.net Sobre o tempo de linkagem note que o computador utilizado é um Pentium 4 3.2GHz, placa-mãe Intel e processador dual core com 512MB de RAM. Resultados O sistema operacional é o Windows XP e as versões 0.9.13 são da mesma data em que a versão 0.9.12 foi publicada. A comparação foi feita usando a seguinte configuração de software:

  • Lazarus 0.9.12 disponível aqui. Free Pascal 2.0.2 que vem com o instalador do Lazarus. LCL and RTL are smartlinked. Refered from now on as simply 0.9.12.
  • Lazarus 0.9.13 downloaded from Subversion from the same date. Free Pascal 2.0.2 installed separately. The LCL is not smartlinked. Refered from now on as simply 0.9.13 + 2.0.2.
  • Lazarus 0.9.13 snapshot. Free Pascal 2.1 that comes with the installer. The LCL is not smartlinked. Refered from now on as simply 0.9.13 + 2.1.
  • Lazarus 0.9.13 snapshot. Free Pascal 2.1 that comes with the installer. The LCL is smartlinked. Refered from now on as simply 0.9.13 + 2.1 + SL.
0.9.12 0.9.13 + 2.0.2 0.9.13 + 2.1 + SL 0.9.13 + 2.1
File Size after strip (in bytes) 1108480 1587712 1425408 1649152
File Size after UPX (in bytes) 318976 438272 388608 454144
Linking time 15 seconds 5 seconds 45 seconds 10 seconds


Conclusion


The 0.9.13 snapshot from the 8th of February 2006 features a unstable compiler from the 2.1 branch, which can cause the bigger executables and slower linking time as compared to the other versions.


The 0.9.12 version has the best file size of all, both with UPX and without, showing that Smartlinking really can diminish the file size in Windows. This, however, does not come without a cost, and the cost is linking time, which is about 3 times higher then without smartlinking.


The 0.9.12 version already comes fully configured for Smartlinking on Windows and no extra configuration is needed. This was not the case on previous releases.

Veja também

  • Guide for anyone inexperienced in getting FPC and Lazarus to work properly.