2015-02-23

How to make your Executable Binaries smaller

There are some good executable compressor, for example UPX. Compressor could reduce your executable size into smaller one, for example a Go compiler always produce a quite big binary, we could reduce it using goupx (requires Go installed), that you can install using this command:

yaourt --needed --noconfirm -S --force upx
go get -u -v github.com/pwaller/goupx

Then you could compress using this command:

$ goupx THE_EXE_FILE
2015/02/23 09:28:36 {Class:ELFCLASS64 Data:ELFDATA2LSB Version:EV_CURRENT OSABI:ELFOSABI_NONE ABIVersion:0 ByteOrder:LittleEndian Type:ET_EXEC Machine:EM_X86_64 Entry:4380896}
2015/02/23 09:28:36 Hemming PT_LOAD section
2015/02/23 09:28:36 File fixed!
                       Ultimate Packer for eXecutables
                          Copyright (C) 1996 - 2013
UPX 3.91        Markus Oberhumer, Laszlo Molnar & John Reiser   Sep 30th 2013

        File size         Ratio      Format      Name
   --------------------   ------   -----------   -----------
   8746160 ->   2413164   27.59%  linux/ElfAMD   THE_EXE_FILE


Packed 1 file.

The result is quite good (22-33%), your program will load faster on slow disk. One drawback about executable compressor is multiple instance/execution would use more RAM, since their code won't be shared.

No comments :

Post a Comment

THINK: is it True? is it Helpful? is it Inspiring? is it Necessary? is it Kind?