Nmap Development mailing list archives

Better compression for the Windows installer


From: David Fifield <david () bamsoftware com>
Date: Tue, 29 Jun 2010 18:37:36 -0600

As explained at http://nsis.sourceforge.net/Docs/Chapter4.html#4.8.2.4,
NSIS installers have three different compression algorithms: zlib,
bzip2, and lzma. Each of those can work in per-file or per-archive
(/SOLID) mode, for six possibilities total. We have been using the
default per-file zlib. I compared the different options with a build of
r18470.

zlib          16822071
zlib /SOLID   16749101  99.57% of zlib
bzip2         16260269  96.66% of zlib
bzip2 /SOLID  16193762  96.26% of zlib
lzma          14823471  88.12% of zlib
lzma /SOLID   14227980  84.58% of zlib

We can get a 15% savings in file size just by adding the line

SetCompressor /SOLID /FINAL lzma

at the top of Nmap.nsi. The only downsides are slightly longer
compression at the end of a build, increased memory usage on
decompression (8 MB versus 32 KB), and possibly slower decompression.
The installer with lzma starts up in a fraction of a second for me. We
can potentially save even more by using the same option in the WinPcap
installer.

How does this sound? At the end of this message is the output of
makensis.exe using the different options.

David Fifield


Using zlib compression.

EXE header size:               51200 / 35328 bytes
Install code:                  18171 / 70040 bytes
Install data:               16740509 / 56155248 bytes
Uninstall code+data:           12187 / 16546 bytes
CRC (0xD0FF2F26):                  4 / 4 bytes

Total size:                 16822071 / 56277166 bytes (29.8%)


Using zlib (compress whole) compression.

EXE header size:               51712 / 35840 bytes
Install code:                          (70040 bytes)
Install data:                          (35778468 bytes)
Uninstall code+data:                   (24239 bytes)
Compressed data:            16697385 / 35872747 bytes
CRC (0x3B088E88):                  4 / 4 bytes

Total size:                 16749101 / 35908591 bytes (46.6%)


Using bzip2 compression.

EXE header size:               50176 / 34304 bytes
Install code:                  17724 / 70040 bytes
Install data:               16179672 / 56155242 bytes
Uninstall code+data:           12693 / 16689 bytes
CRC (0x9F049F46):                  4 / 4 bytes

Total size:                 16260269 / 56276279 bytes (28.8%)


Using bzip2 (compress whole) compression.

EXE header size:               50688 / 34816 bytes
Install code:                          (70040 bytes)
Install data:                          (35778492 bytes)
Uninstall code+data:                   (24239 bytes)
Compressed data:            16143070 / 35872771 bytes
CRC (0x904A246F):                  4 / 4 bytes

Total size:                 16193762 / 35907591 bytes (45.0%)


Using lzma compression.

EXE header size:               49664 / 33792 bytes
Install code:                  15649 / 70040 bytes
Install data:               14747503 / 56155250 bytes
Uninstall code+data:           10651 / 16204 bytes
CRC (0x901B57A1):                  4 / 4 bytes

Total size:                 14823471 / 56275290 bytes (26.3%)


Using lzma (compress whole) compression.

EXE header size:               50176 / 34304 bytes
Install code:                          (70040 bytes)
Install data:                          (35778458 bytes)
Uninstall code+data:                   (24239 bytes)
Compressed data:            14177800 / 35872737 bytes
CRC (0xA3E8C7AA):                  4 / 4 bytes

Total size:                 14227980 / 35907045 bytes (39.6%)
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: