UPX - packing your executable
by Thomas \"Man of Ice\" Lund · in General Discussion · 09/16/2004 (1:14 pm) · 7 replies
I just wanted to point everyone over to a most fantastic piece of code - UPX
I've earlier read about it and its also mentioned here, but today I tested the beast for the first time
What is it?
This little bugger takes your executable and compresses it. The good thing about this is, that uncompression is done in runtime when you start the exe file. It is NOT unpacking the exe to another file, so its just point and click for end users. They will never know it was compressed in the first place.
TGE Test data
What opened my eyes was a little test. Here are the result
Thats right!!! A 2.5 MB exe file is packed to under 1 MB - with no loss of any performance except a few milliseconds startup time.
As we indies distribute over the net as download, download size is important as you know.
What does it cost and where to get it
Its free! And can be used for commercial products too with no license issues at all.
upx.sf.net
Enjoy
I've earlier read about it and its also mentioned here, but today I tested the beast for the first time
What is it?
This little bugger takes your executable and compresses it. The good thing about this is, that uncompression is done in runtime when you start the exe file. It is NOT unpacking the exe to another file, so its just point and click for end users. They will never know it was compressed in the first place.
TGE Test data
What opened my eyes was a little test. Here are the result
C:\source\battleship_repos\game>upx.exe -o test.exe torqueDemo.exe
Ultimate Packer for eXecutables
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
UPX 1.25w Markus F.X.J. Oberhumer & Laszlo Molnar Jun 29th 2004
File size Ratio Format Name
-------------------- ------ ----------- -----------
2527232 -> 999936 39.57% win32/pe test.exe
Packed 1 file.
C:\source\battleship_repos\game>upx.exe --best -o test2.exe torqueDemo.exe
Ultimate Packer for eXecutables
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
UPX 1.25w Markus F.X.J. Oberhumer & Laszlo Molnar Jun 29th 2004
File size Ratio Format Name
-------------------- ------ ----------- -----------
2527232 -> 986624 39.04% win32/pe test2.exe
Packed 1 file.Thats right!!! A 2.5 MB exe file is packed to under 1 MB - with no loss of any performance except a few milliseconds startup time.
As we indies distribute over the net as download, download size is important as you know.
What does it cost and where to get it
Its free! And can be used for commercial products too with no license issues at all.
upx.sf.net
Enjoy
#2
It's a great program. Don't forget it works on DLLs, too.
09/16/2004 (1:24 pm)
Aye, been using UPX for a while. (And before that in the DOS days, LZEXE.)It's a great program. Don't forget it works on DLLs, too.
#3
UPX will do a extremely good job compressing your exe, however the real test is when you have all your other data that you need to ship. I did a little test of my own to see what effect UPX had on the final package size.
I did the following
1. Downloaded the current TGE demo and installed it.
2. Copied the installed files (minus uninstall exe and getdxver.exe) to "torque\install_build\demo\staging"
(getdxver.exe is included by the install script from "torque\install_build")
3. Used NSIS 2 on the installer script (torque\install_build\demo\win32\installer.nsi) with the option to select the best compression to produce an installer.
4. Used upx to recreate the *decompressed* version of the demo.exe and repeated 3.
Both times lzma was found to be the best compresser.
The results:
TorqueGameEngineDemo-1-3withupx.exe 7,503 KB
TorqueGameEngineDemo-1-3.exe 7,464 KB
Therefore in this case it is better for download size if you don't UPX your demo.exe before building the installer, giving a saving of 39KB.
Yes amazing savings!, im sure you'll agree. However the point of the exercise is to show that pre-compressing files may or may not be worth it. Of course given a different set of data it may be better to UPX.
Stange thing i noticed during this test TorqueDemo-Installer.exe from GG is 8,299 KB. So either i've made some big mistake or GG may want to do a rebuild of their installer with NSIS 2 (lzma) and get quite a nice saving.
09/16/2004 (2:23 pm)
Beware false idols!UPX will do a extremely good job compressing your exe, however the real test is when you have all your other data that you need to ship. I did a little test of my own to see what effect UPX had on the final package size.
I did the following
1. Downloaded the current TGE demo and installed it.
2. Copied the installed files (minus uninstall exe and getdxver.exe) to "torque\install_build\demo\staging"
(getdxver.exe is included by the install script from "torque\install_build")
3. Used NSIS 2 on the installer script (torque\install_build\demo\win32\installer.nsi) with the option to select the best compression to produce an installer.
4. Used upx to recreate the *decompressed* version of the demo.exe and repeated 3.
Both times lzma was found to be the best compresser.
The results:
TorqueGameEngineDemo-1-3withupx.exe 7,503 KB
TorqueGameEngineDemo-1-3.exe 7,464 KB
Therefore in this case it is better for download size if you don't UPX your demo.exe before building the installer, giving a saving of 39KB.
Yes amazing savings!, im sure you'll agree. However the point of the exercise is to show that pre-compressing files may or may not be worth it. Of course given a different set of data it may be better to UPX.
Stange thing i noticed during this test TorqueDemo-Installer.exe from GG is 8,299 KB. So either i've made some big mistake or GG may want to do a rebuild of their installer with NSIS 2 (lzma) and get quite a nice saving.
#4
09/16/2004 (3:16 pm)
I've heard there are problems with UPX'ed .exes on Server 2003 and on some XP SP2 systems. (program crash when clicking the .exe) Can anyone verify this?
#5
UPX will shave a bit off your .EXE and is just something you should do for a release build.... but another thing people overlook is the art assets.... these beasts are what will kill your modem user. But there are solutions... .BM8 and .JPG are two things you can use to provide a smaller download for your modem user. While leaving you the option to provide an "enhanced graphics demo" for the bandwidth blessed.
09/16/2004 (4:07 pm)
Personally I'm one of those people who think the demo's need to be broken down a bit more to provide the widest possible distribution depending on bandwidth.UPX will shave a bit off your .EXE and is just something you should do for a release build.... but another thing people overlook is the art assets.... these beasts are what will kill your modem user. But there are solutions... .BM8 and .JPG are two things you can use to provide a smaller download for your modem user. While leaving you the option to provide an "enhanced graphics demo" for the bandwidth blessed.
#6
09/16/2004 (4:24 pm)
WE use for Lore as well, good stuff
#7
09/17/2004 (7:36 pm)
Woah, thats pretty cool tool then, i didn't even notice a performance loss or anything with the Torque Demo!
Associate Kyle Carter
UPX is a great product!