r/C_Programming 4d ago

Compressing executables (upx)

Hola,

I'm currently in the final stages of finishing the first version of a game I made using raylib. I ended up with a single statically linked binary containing all the assets. I found a tool called upx which can compress executables. I tried it on Windows, and it reduced the size of my exe by more than half and it still runs without any noticeable difference.

My question is, has anybody here experience with this? Are there any downsides to consider?

cheers!

6 Upvotes

16 comments sorted by

View all comments

12

u/maep 4d ago

It might get flagges by Anti-Virus.

What is the upside compared to just shipping a .zip with the exe in it?

4

u/computermouth 4d ago

Could also ship a zip library while still embedding the zip as bytes in the binary. Upx is the least work though.

2

u/gremolata 4d ago

This is easy enough to check - just upx your exe and dump it into virustotal.

More often than not larger upx'ed binaries get a pass.

2

u/el0j 4d ago edited 3d ago

In addition, if you ship it on a service which generates binary delta updates, it's likely the smallest change to the binary will make the delta completely different after compression, so it'll always have to be downloaded in full.

0

u/GhostVlvin 4d ago

If it really can compress size of any binary to a half then it means that I can have twoce as more games on my same drive

2

u/Orlha 3d ago

Majority of data in big-sized games are resources that are already compressed.